Try:

for(i in index(l))
{
  eval(parse(text=paste("setSymbolLookup(",l[i],"=list(src='yahoo'))")))
}


> l = c("MSFT","IBM")
> for(i in index(l))
+ {
+   eval(parse(text=paste("setSymbolLookup(",l[i],"=list(src='yahoo'))")))
+ }
> getSymbolLookup("MSFT")
$MSFT
$MSFT$src
[1] "yahoo"


> getSymbolLookup("IBM")
$IBM
$IBM$src
[1] "yahoo"


HTH
Jeff
On Wed, Jul 21, 2010 at 10:42 AM, Anass Mouhsine
<anass.mouhsine@gmail.com>wrote:

> 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
>
> _______________________________________________
> R-SIG-Finance@stat.math.ethz.ch 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.
>



-- 
Jeffrey Ryan
jeffrey.ryan@insightalgo.com

ia: insight algorithmics
www.insightalgo.com

	[[alternative HTML version deleted]]

