[R-SIG-Finance] using getSymbols() with variable symbols
Robert Iquiapaza
rbali at ufmg.br
Tue Dec 3 20:45:45 CET 2013
This works (use auto.assign=FALSE in getSymbols)
Robert
require(quantmod)
symbol.list <- c("LSCC","LSI","LSTR","LTBR","LTON","LTRE","LTRX","LTXC")
for(i in 1:8){#i=1
symbol <- getSymbols(symbol.list[i],auto.assign=FALSE)
ticker <- last(symbol,'12 months')
barChart(ticker)
}
2013/12/3 <manojit_roy at comcast.net>:
> 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.
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
More information about the R-SIG-Finance
mailing list