[R-SIG-Finance] [quantmod] setSymbolLookup in a loop
Anass Mouhsine
anass.mouhsine at gmail.com
Wed Jul 21 17:42:25 CEST 2010
Hi all,
I have a list of stocks in a variable e.g. l = c("MSFT","IBM")
using a loop, I would like to use each stock symbol in the function
setSymbolLookup.
to be more specific, I know how to use the function setSymbolLookup from
the R prompt for one symbol e.g. setSymbolLookup(MSFT=list(src='yahoo')).
What I want now is ,within a loop, use this function
for(i in index(l))
{
setSymbolLookup(l[i]=list(src='yahoo'))
}
the problem is in the l[i] wtihin the function.
> t="MSFT"
> setSymbolLookup(t=list(src='yahoo'))
> getSymbolLookup('MSFT')
$<NA>
NULL
> getSymbolLookup('t')
$t
$t$src
[1] "yahoo"
I woulk to have MSFT as a symbol rather than the variable t.
How could I solve my problem?
thanks in advance,
Anass
More information about the R-SIG-Finance
mailing list