Well, there is an implicit for loop, expressed by: x[i] = complexFn(x[i-1], x[i-2])
But my response is along the lines of: It really depends what your "..." is. How about something like (pseudo-code again): x[1] <- something x[2] <- something_else x = complexFn(x) so the vectorisation is taken care of inside complexFn. Ray Brownrigg On Wed, 12 Nov 2008, hadley wickham wrote: > On Tue, Nov 11, 2008 at 8:30 PM, Kinoko <[EMAIL PROTECTED]> wrote: > > Dear list, > > > > Is there a way to do something like the following pseudo-code - > > without for loop? > > There isn't a for loop in your code! > > Hadley > > > complexFn <- function(a,b){ > > ... > > return(c) > > } > > > > x[i] = complexFn(x[i-1], x[i-2]) > > > > > > I have found "filter" but would like to do something more complicated > > than multiplication with x[i-1] and x[i-2]. > > > > Thanks in advance! > > > > gabor > > ______________________________________________ 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.