There are very nifty ways of subsetting xts
objects. For example, one can get all the data for all years, months, days but being strictly between 9:30 AM and 4 PM by doing:
my_xts["T09:30/T16:00"]
Or you can get all the observations between two dates by doing:
my_xts["2012-01-01/2012-03-31"]
Or all the dates before/after a certain date by doing:
my_xts["/2011"] # from start of data until end of 2011
my_xts["2011/"] # from 2011 until the end of the data
How can I get all the data for only certain months for all years or only certain days for all months and years? Do any other subsetting tricks exist?
which.i
: stackoverflow.com/a/32029644/841830dt['2009',]
, filtering year and monthdt[':2009-01',]
and using a date range:dt['2009-01-01::2009-02-01']
.