xts's hourly endpoints and daylight savings

。_饼干妹妹 提交于 2019-12-04 15:28:32

Just a hunch but this may be yet another manifestation of TZ and a switch from standard time to daylight savings time. Try to convert to UTC and see what happens.

Alternatively, move your data by a week (or month or ...) and see if the same issue arises.

And if that's the issue. then this is not really a bug as the 'fall back' night has indeed two hours starting at 02:00am.

Edit: And while you didn't say what your timezone was, and while it doesn't work in mine (US Central), we can exhibit the issue for the European continent:

R> ISOdate(2007, 10, 28, 0, 30, 0, tz="Europe/Berlin") + seq(0,4)*60*60
[1] "2007-10-28 00:30:00 CEST" "2007-10-28 01:30:00 CEST"
[3] "2007-10-28 02:30:00 CEST" "2007-10-28 02:30:00 CET" 
[5] "2007-10-28 03:30:00 CET" 
R> 

See how

  1. the TZ attribute switches from CEST to CET

  2. there are in fact two 02:30:00 hours, one for each of the two timezones.

So no bug in xts but a feature in the data.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!