Possible Duplicate:
r names of quantmod variables
R: merging a lot of data.frames
I would like to perform a function on several objects. I know I can use merge()
for 2:
library(quantmod)
symb <- c('AAPL', 'GE')
getSymbols(symb, from='2005-01-01')
foo <- merge(AAPL$AAPL.Adjusted, GE$GE.Adjusted)
But let's say symb
is all the constituents of the Dow Industrials; getSymbols
returns 30 objects. I still want to end up with a table or xts of adjusted prices for all 30 stocks.
I can imagine a merge
loop that would add each symbol's Adjusted column to the new object, but:
- This is inelegant. Is there a better way? Someone suggested
Reduce()
, but I couldn't make sense of it in this context. - I don't know how to call each of the symbols that will appear in
objects()
anyway.