xts tick data rolling subset

南楼画角 提交于 2019-11-28 11:44:13

You can do it with time-of-day subsetting:

merged["T10:00/T14:30"]

You can use difftime to calculate the hours from the start of the day, e.g.:

diffs <- difftime(time(merged), as.Date(time(merged)), units="hours", tz="SAST")

and then subset with it as a boolean index:

merged[diffs > 10 & diffs < 14.5]

You can also use POSIXlt :

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