Hi Joshua,

Thank you for showing me how to use the getSymbols function. So I tried the
following without success - 

> tickers
 [1] "SPY" "DIA" "IWM" "SMH" "OIH" "XLY" "XLP" "XLE" "XLI" "XLB" "XLK" "XLU"
"XLV"
[14] "QQQ"
> str(tickers)
 chr [1:14] "SPY" "DIA" "IWM" "SMH" "OIH" "XLY" "XLP" "XLE" ...

> ClosePrices <- do.call(merge, lapply(tickers,myX,start="2001-03-01",
> end="2011-03-11"), Cl(get(myX)))

Error in get(myX) : invalid first argument

The code for function myX is as follows:

myX <- function(tickers, start, end) {
require(quantmod) 
getSymbols(tickers, from=start, to=end)
}

I'm not sure why you are using the Cl(get(x)) function in your do.call
invocation. I greatly appreciate some guidance.

Thank you

--
View this message in context: 
http://r.789695.n4.nabble.com/pass-character-vector-in-instrument-field-of-get-hist-quote-function-tp3350779p3431001.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to