[R] as.Date() results depend on order of data within vector?

Mark Wardle mark at wardle.org
Sun Jan 7 14:11:38 CET 2007

Prof Brian Ripley wrote:

> The correct work-around is to get non-valid strings returned as NA, not
> "".  That is argument 'na.strings' in RODBC (and elsewhere: read.table
> behaves in the same way).

Thanks for these replies.

As I have mentioned before, my peculiar combination of PostgreSQL,
Actual's ODBC driver on Mac OS X, and RODBC means that for numbers and
dates, NULL values are passed to R as empty strings rather than NAs (2).
This does not occur with PostgreSQL's "text" column type.

For the benefit of others who in the future may use this combination(1),
my workaround for numbers/integers/boolean values is to essentially have
temporary intermediate tables with columns of type "text" whatever the
format, and let R/RODBC parse the strings into the correct resulting
format (which it then does faultlessly). This does not work for dates
however, and so I must use one of the two workarounds I mentioned in my

Best wishes,


(1) unlikely as it may be
(2) I still cannot fathom why integers and dates are not handled correctly.

More information about the R-help mailing list