I stubbled across what appears to be a odd error in the as.POSXct
function in R associated with date/time of 2 am on March 9, 2014.
The following simple example shows the nature of the bug.
3 am works
> as.POSIXct("2014-Mar-09 03:00", format="%Y-%b-%d %H:%M")
[1] "2014-03-09 03:01:00 MDT"
2 am fails
> as.POSIXct("2014-Mar-09 02:00", format="%Y-%b-%d %H:%M")
[1] NA
Any time within 2 am fails
> as.POSIXct("2014-Mar-09 02:01", format="%Y-%b-%d %H:%M")
[1] NA
> as.POSIXct("2014-Mar-09 02:59", format="%Y-%b-%d %H:%M")
[1] NA
March 10, 2014 is fine
> as.POSIXct("2014-Mar-10 02:00", format="%Y-%b-%d %H:%M")
[1] "2014-03-10 02:00:00 PDT"
The original conversions specified the timezone (tz='Canada/Mountain'
), which has been excluded for brevity. The same results were observed. Adding non-existing seconds or changing the format (example %I
for 12 hr time) didn't work either.
What is going on? This is for R version 3.2.3 (OS X).