[R] How to eliminate this for loop ?

PLucas plucasplucasplucas at yopmail.com
Mon Nov 8 10:25:37 CET 2010


Hi, I would like to create a list recursively and eliminate my for loop :

a<-c()
a[1] <- 1; # initial value
for(i in 2:N) {
	a[i]<-a[i-1]*b - c[i-1] # b is a value, c is another vector
}


Is it possible ?

Thanks
-- 
View this message in context: http://r.789695.n4.nabble.com/How-to-eliminate-this-for-loop-tp3031667p3031667.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list