Re: [R] pass character vector in instrument field of get.hist.quote function

From: algotr8der <>
Date: Wed, 06 Apr 2011 08:16:39 -0700 (PDT)

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 <-, 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) {
getSymbols(tickers, from=start, to=end)

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

Thank you

View this message in context:
Sent from the R help mailing list archive at

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 06 Apr 2011 - 20:26:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 06 Apr 2011 - 20:30:29 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive