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