[R] as.POSIXct problem?
ripley at stats.ox.ac.uk
Fri Jan 3 08:49:02 CET 2003
On Thu, 2 Jan 2003, Frank E Harrell Jr wrote:
> platform i686-pc-linux-gnu
> arch i686
> os linux-gnu
> system i686, linux-gnu
> major 1
> minor 6.1
> year 2002
> month 11
> day 01
> language R
> > x <- strptime(c('10/10/1969','12/31/2002'),format='%m/%d/%Y')
> > x
>  "1969-10-10" "2002-12-31"
> > as.POSIXct(x)
>  NA "2002-12-31 EST"
> Why the NA? If this is not the preferred way to convert a character
string to POSIXct what is?
It's a function of your system, which is telling you that is an invalid
*time* (it is midnight, BTW). I get
 "1969-10-10 GMT" "2002-12-31 GMT"
Did by any chance your locale change time zones that day? Trying giving a
valid time as well.
> On a more minor note why the EST if no time is printed?
Because it has to be in some time zone, and it uses the current one if you
did not specify it (there is a tz argument, and it is described on the
help page!). As far as I can see from your email headers you are in EST.
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help