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]]
I don't suppose April 4 happens to be the date when "daylight savings time" began in 2004? In which case 2:00 AM is a time that doesn't exist ("spring forward" at 02:00) -Don At 5:48 PM -0400 5/26/08, 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.-- --------------------------------- Don MacQueen Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062 macq at llnl.gov
>From the help page for strptimeRemember 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
Seemingly Similar Threads
- Error: Cannot Coerce POSIXt to POSIXct when building package
- Help with POSIXct
- daylight saving / time zone issues with as.POSIXlt/as.POSIXct (PR#10392)
- as.POSIXct month problem
- Floating point precision causing undesireable behaviour when printing as.POSIXlt times with microseconds?