[R] Nesting Functions

2006-01-26 Thread Manuel Morales
Dear list members, I'm looking for a way to write "nested" functions similar to the function "Nest" or "NestList" in Mathematica. E.g., f<-function(x) x+2*x f(f(f(2))) might instead be written as nest(f, 2, 3) read as, nest function f 3 times with 2 as the initial value. Thanks! Manuel ___

Re: [R] Nesting Functions

2006-01-26 Thread Duncan Murdoch
On 1/26/2006 9:45 PM, Manuel Morales wrote: > Dear list members, > > I'm looking for a way to write "nested" functions similar to the > function "Nest" or "NestList" in Mathematica. > > E.g., > > f<-function(x) x+2*x > > f(f(f(2))) > > might instead be written as nest(f, 2, 3) > > read as, ne

Re: [R] Nesting Functions

2006-01-27 Thread Manuel Morales
On Thu, 2006-01-26 at 21:55 -0500, Duncan Murdoch wrote: > On 1/26/2006 9:45 PM, Manuel Morales wrote: > > Dear list members, > > > > I'm looking for a way to write "nested" functions similar to the > > function "Nest" or "NestList" in Mathematica. > > > > E.g., > > > > f<-function(x) x+2*x > >

Re: [R] Nesting Functions

2006-01-27 Thread Duncan Murdoch
On 1/27/2006 9:07 PM, Manuel Morales wrote: > On Thu, 2006-01-26 at 21:55 -0500, Duncan Murdoch wrote: >> On 1/26/2006 9:45 PM, Manuel Morales wrote: >>> Dear list members, >>> >>> I'm looking for a way to write "nested" functions similar to the >>> function "Nest" or "NestList" in Mathematica. >>>