The following R code returns an unexpected output:
times = c("2014-12-01 15:59:00", "2014-12-01 16:00:00", "2014-12-01 16:01:00")
values = c(64.23, 64.43, 64.31)
tim <- as.POSIXct(c("2014-12-01 15:59:00", "2014-12-01 16:00:00", "2014-12-01 16:01:00"), tz="GMT")
myts <- xts(values, tim, tzone="GMT")
print(myts[.indexhour(myts)==16])
I get:
[,1]
2014-12-01 15:59:00 64.23
While I would expect:
[,1]
2014-12-01 16:00:00 64.43
2014-12-01 16:01:00 64.31
I think .indexhour is somehow referring to my local timezone, while I obviously expect it to use the XTS object timezone.
Is there anything I can do to fix it?
This is bug #5891 and has been patched on R-Forge as of revision 844.