[R-SIG-Finance] how to rename stock codes?
Marco Sun
hs13322 at my.bristol.ac.uk
Thu Dec 4 08:32:12 CET 2014
Hello Sage R people,
I am able to retrieve data and rename the stock code one by one through quantmod package as the following:
symbols<-c("AAPL","MSFT")
stockcodes<-c("A","B")
setSymbolLookup(A=list(name="AAPL",src="yahoo"))
getSymbols("A")
setSymbolLookup(B=list(name=MSFT",src="yahoo"))
getSymbols(B")
However, the same logic is not approachable in the mass production era like this:
for (i in 1:2)
{
getSymbolLookup(stockcodes[i]=list(name=symbols[i],src="yahoo"))
getSymbols("stockcodes[i]")
}
I guess the problem lies in stockcodes[i] as indicated in red. Any comment would be appreciated.
Thanks in advance,
Marco
[[alternative HTML version deleted]]
More information about the R-SIG-Finance
mailing list