> head(stock)
symbol Open High Low Close volume Adjusted
2007-01-03 "AAPL" "12.327143" "12.368571" "11.7" "11.971429" "309579900" "8.104136"
2007-01-03 "AMZN" "38.68" "39.060001" "38.049999" "38.700001" "12405100" "38.700001"
2007-01-03 "GOOG" "231.494354" "236.789917" "229.065155" "232.28421" "15513200" "232.28421"
2007-01-03 "MSFT" "29.91" "30.25" "29.4" "29.860001" "76935100" "22.858253"
2007-01-04 "AAPL" "12.007143" "12.278571" "11.974286" "12.237143" "211815100" "8.284014"
2007-01-04 "AMZN" "38.59" "39.139999" "38.259998" "38.900002" "6318400" "38.900002"
这是用quantmod包整理出来的数据框,老师给的作业是
1. Using the filter function to select stock quotes only for the last two years (tip: filter(date >= today() — years(2))
请教诸位大牛一下问题如何解决:
[size=18.6667px]> filter(stock,date >= today() - years(2))
Errerror in UseMethod("filter_") :
no no applicable method for 'filter_' applied to an object of class "c('xts', 'zoo')
q