An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20131203/bfc9d53a/attachment.pl>
using getSymbols() with variable symbols
3 messages · manojit_roy at comcast.net, Joshua Ulrich, Robert Iquiapaza
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
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.