1

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.
Community
  • 1
  • 1
jaredwoodard
  • 897
  • 1
  • 7
  • 8
  • 3
    I think [this answer](http://stackoverflow.com/a/11179369/967840) is a common and safe way to do this with `getSymbols` – GSee Jan 02 '13 at 22:07
  • 2
    Related: [getSymbols and using lapply, Cl, and merge to extract close prices](http://stackoverflow.com/q/5574595/271616) – Joshua Ulrich Jan 02 '13 at 22:10

0 Answers0