Displaying 1 result from an estimated 1 matches for "spmon".
Did you mean:
simon
2012 Aug 05
1
R: Help xts object Subset Date by Day of the Week
...ata
getSymbols("SPY")
# Subset Prices to just closing price
SP500 <- Cl(SPY)
# Show day of the week for each date using 2-6 for monday-friday
SP500wd <- wday(SP500)
# Add Price and days of week together
SP500wd <- cbind(SP500, SP500wd)
# subset Monday into one xts object
SPmon <- subset(SP500wd, SP500wd$..2=="2")
I then used the package lubridate to show the days of the week. Due to the
requirement of an xts objects to be numeric you will see each day is
represented as a number so that Monday is =2, Tuesday=3, Wednesday=4,
Thursday=5, Friday=6, Satu...