Garrett Grolemund
2010-May-10 18:26 UTC
[R] System neutral Daylight Savings Time response?
I'm searching for an r command that will notify me if I create a time that does not exist due to Daylight Savings Time. For example, if I run the following command on a windows machine> ISOdatetime(2010,03,14,2,10,0, tz = "") # My system time is set to theUnited States Central Time Zone [1] NA R returns NA, which is the behavior I want. However, if I run the same command on a mac, R returns a POSIXct object and I have to examine the object manually to notice that I had tried to create an impossible time. ISOdatetime(2010,03,14,2,10,0, tz = "") [1] "2010-03-14 01:10:00 CST" Is there a method of creating time objects in R that will always return NA for non-existant times, no matter the operating system? Thank you sincerely, Garrett [[alternative HTML version deleted]]
Gabor Grothendieck
2010-May-10 23:21 UTC
[R] System neutral Daylight Savings Time response?
Perhaps you should be using the chron package. It has no time zones in the first place. On Mon, May 10, 2010 at 2:26 PM, Garrett Grolemund <gg7 at rice.edu> wrote:> I'm searching for an r command that will notify me if I create a time that > does not exist due to Daylight Savings Time. For example, if I run the > following command on a windows machine > >> ISOdatetime(2010,03,14,2,10,0, tz = "") # My system time is set to the > United States Central Time Zone > [1] NA > > R returns NA, which is the behavior I want. However, if I run the same > command on a mac, R returns a POSIXct object and I have to examine the > object manually to notice that I had tried to create an impossible time. > > ISOdatetime(2010,03,14,2,10,0, tz = "") > [1] "2010-03-14 01:10:00 CST" > > Is there a method of creating time objects in R that will always return NA > for non-existant times, no matter the operating system? > > Thank you sincerely, > Garrett > > ? ? ? ?[[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. >