[R] For loop - how to assign "i" when it is not an element of an index?
Scotty Nelson
poorboy44 at hotmail.com
Tue Oct 21 08:01:47 CEST 2008
Hello,
I'm trying to build a for loop, where I estimate a series of models with
different sets of (time series) data.
However my for loop doesn't recognize the "i"
##################### code################
window.1=anomalies.CAK[(positions(anomalies.CAK)>=timeDate("1/1/1971") &
positions(anomalies.CAK)<=timeDate("6/30/1991") )]
....
window.14=anomalies.CAK[(positions(anomalies.CAK)>=timeDate("1/1/1984") &
positions(anomalies.CAK)<=timeDate("6/30/2004") ),]
for (i in 1:14){
ar1mods[1] = lm ( formula = window.i~ ar(1) )
}
################################# end code ###################
Problem: Object "window.i" not found
Anybody have a quick tip on what I'm doing wrong?
--
View this message in context: http://www.nabble.com/For-loop---how-to-assign-%22i%22-when-it-is-not-an-element-of-an-index--tp20083917p20083917.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list