[R] is.na() == TRUE for POSIXlt time / date of "2014-03-09 02:00:00"

William Dunlap wdunlap at tibco.com
Wed Jul 30 19:54:34 CEST 2014


> I should have mentioned that I tried other time stamps, generated the
> same way as "q" above.

How did you generate q and in what time zone were you?  Note that 2am
on 9 March 2014 is when 'daylight savings time' started in the parts
of the US where it is observed.  Does 2am exist or do we jump from
1:59:59 to 3:00:00?


Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Wed, Jul 30, 2014 at 10:42 AM, John McKown
<john.archie.mckown at gmail.com> wrote:
> On Wed, Jul 30, 2014 at 12:18 PM, Duncan Murdoch
> <murdoch.duncan at gmail.com> wrote:
>> On 30/07/2014 1:08 PM, John McKown wrote:
>>>
>>> "I'm so confused!" Why does is.na() report TRUE for a POSIXlt date &
>>> time of 2014-03-09 02:00:00 ?
>>>
>>> > q
>>> [1] "2014-03-09 02:00:00"
>>> > is.na(q)
>>> [1] TRUE
>>> > as.POSIXct(q)
>>> [1] NA
>>> > dput(q)
>>> structure(list(sec = 0, min = 0L, hour = 2, mday = 9L, mon = 2L,
>>>      year = 114L, wday = 0L, yday = 67L, isdst = 0L, zone = "",
>>>      gmtoff = NA_integer_), .Names = c("sec", "min", "hour", "mday",
>>> "mon", "year", "wday", "yday", "isdst", "zone", "gmtoff"), class =
>>> c("POSIXlt",
>>> "POSIXt"))
>>
>>
>> I see an NA in there for the GMT offset, and no timezone.
>
> I should have mentioned that I tried other time stamps, generated the
> same way as "q" above. They did not fail the is.na() test. I think
> that is.na() is doing a as.double() somewhere in there because
> as.double(q)  gives  NA as a result.
>
>>
>> Duncan Murdoch
>>
>>> > str(q)
>>>   POSIXlt[1:1], format: "2014-03-09 02:00:00"
>>> >
>>>
>>>
>>
>
>
>
> --
> There is nothing more pleasant than traveling and meeting new people!
> Genghis Khan
>
> Maranatha! <><
> John McKown
>
> ______________________________________________
> 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.



More information about the R-help mailing list