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.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to