From: Marco Sun <hs13322 at my.bristol.ac.uk>
Subject: how to rename stock codes?
Date: 4 December 2014 03:32:12 pm GMT+8
To: r-sig-finance at r-project.org
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