I have the following code:
library(quantmod)
tckrs <- c(\"TLT\", \"LQD\", \"HYG\", \"SPY\", \"DBC\")
NumTckrs <- length(tckrs)
getSymbols(tckrs, from
Load all the data into an environment, then call Ad on each, and merge them. Also note that getSymbols returns an xts object by default, therefore your MainDF is an xts object, not a data.frame.
library(quantmod)
# create new environment
myEnv <- new.env()
# pull all data and load into myEnv
getSymbols("TLT;LQD;HYG;SPY;DBC", env=myEnv)
# eapply calls Ad on each symbol in myEnv and returns a list
# do.call calls merge with each element returned from eapply as an argument
MainXTS <- do.call(merge, c(eapply(myEnv, Ad),all=FALSE))