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
You can use the .index*
family of functions to get certain months or certain days of the month. See ?index
for the full list of functions. For example:
library(quantmod)
getSymbols("SPY")
SPY[.indexmon(SPY)==0] # January for all years (note zero-based indexing!)
SPY[.indexmday(SPY)==1] # The first of every month
SPY[.indexwday(SPY)==1] # All Mondays