[R] Strange behaviour of as.POSIXct

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue May 27 08:02:02 CEST 2008


>From the help page for strptime

      Remember that in most timezones some times do not occur and some
      occur twice because of transitions to/from summer time.  What
      happens in those cases is OS-specific.

Now Switzerland will have times in CET and not in EST5EDT, and the DST 
transition times are different in different countries.  Add tz="CET" to 
your call (or "Europe/Zurich").

On Mon, 26 May 2008, Josephy, Norman wrote:

> Hi:
>
> I do not understand the returned value of NA in the following, which is 
> a simplified version of my attempt to convert the start column of the 
> data frame AirQual in the SwissAir package.
>
> as.POSIXct(paste('04.04.2004 0',0:3,sep=''),format='%d.%m.%Y %H')
> [1] "2004-04-04 00:00:00 EST" "2004-04-04 01:00:00 EST"
> [3] NA                        "2004-04-04 03:00:00 EDT"
>
> My sessionInfo() is
>
> sessionInfo()
> R version 2.7.0 (2008-04-22)
> i386-pc-mingw32
> locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods
> [7] base
>
> Thank you,
>
> Norm
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
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 mailing list