Richard Richard - 4 months ago 28
R Question

Subset xts object by time of day

A simple question: I know how to subset time series in

for years, months and days from the help:
and so on.

But how can I subset my data by hours of the day? I would like to get all data between 07:00 am and 06:00 pm. I.e., I want to extract the data during business time - irrelevant of the day (I take care for weekends later on). Help has an example of the form:


But this does not work in my case. Does anybody have a clue?


If your xts object is called x then something like y <- x["T09:30/T11:00"] works for me to get a slice of the morning session, for example.