[R] any alternatives for complex for-loops?

From: Kinoko <andzsinszan_at_gmail.com>
Date: Tue, 11 Nov 2008 18:30:09 -0800 (PST)


Dear list,

Is there a way to do something like the following pseudo-code - without for loop?

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_at_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. Received on Wed 12 Nov 2008 - 02:37:16 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 12 Nov 2008 - 03:30:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive