Message-ID: <1352586996098-4649215.post@n4.nabble.com>
Date: 2012-11-10T22:36:36Z
From: dae
Subject: For loop question
I have this code:
IEF <- to.monthly(IEF, indexAt="endof")
SPY <- to.monthly(SPY, indexAt="endof")
I would like to use a for loop instead of separate entries,
so the only code that needs to be modified is the list
of symbols.
symbols <- c("IEF", "SPY")
for(symbol in symbols) {
symbol <- to.monthly(symbol, indexAt="endof")
}
This for loop doesn't work. It puts each output into
*symbol *not into *IEF *and *SPY*.
How do I put the output into the existing objects using
a for loop?
Note: to.monthly() is an xts function
--
View this message in context: http://r.789695.n4.nabble.com/For-loop-question-tp4649215.html
Sent from the R help mailing list archive at Nabble.com.