[R-SIG-Finance] using getSymbols() with variable symbols

Joshua Ulrich josh.m.ulrich at gmail.com
Tue Dec 3 19:53:14 CET 2013


On Tue, Dec 3, 2013 at 12:04 PM,  <manojit_roy at comcast.net> wrote:
> I am trying to extract symbols and plot them in a loop, using a variable to assign each symbol, as follows:
>
>> symbol.list <- c("LSCC","LSI","LSTR","LTBR","LTON","LTRE","LTRX","LTXC")
>> for(i in 1:8){
>>      symbol <- getSymbols(symbol.list[i])
>>      ticker <- last(symbol,'12 months')
>>      barChart(ticker)
>>}
>
> I am getting an error message "Error in NROW(x) - n : non-numeric argument to binary operator". I think I know where the problem is, but do not know how to extract the output of getSymbols() in a format than can be passed on to last(). Any help is appreciated.
>
Read ?getSymbols and run the examples.  Pay special attention to the
auto.assign arg.

Best,
--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com



More information about the R-SIG-Finance mailing list