Re: [R] Building the call of an arbitrary function

2006-09-20 Thread Vincent Goulet
Le Dimanche 17 Septembre 2006 14:12, Duncan Murdoch a écrit : On 9/17/2006 12:36 PM, Vincent Goulet wrote: Hy all, Is there a direct way to build the complete function call of an arbitrary function? Here's what I want to do. A function will build a function which will itself call a

[R] Building the call of an arbitrary function

2006-09-17 Thread Vincent Goulet
Hy all, Is there a direct way to build the complete function call of an arbitrary function? Here's what I want to do. A function will build a function which will itself call a probability density function for some law given in argument to the first function: f(gamma, 1000) will return,

Re: [R] Building the call of an arbitrary function

2006-09-17 Thread Gabor Grothendieck
Try this. We use do.call to call f with the args defined by ... except that we replace the first arg with ..1+a (where ..1 means first arg in R): F - function(f, a) function(...) do.call(match.fun(f), replace(list(...), 1, ..1 + a)) g - F(+, 1000) g(1,2) # 1003 On 9/17/06, Vincent

Re: [R] Building the call of an arbitrary function

2006-09-17 Thread Duncan Murdoch
On 9/17/2006 12:36 PM, Vincent Goulet wrote: Hy all, Is there a direct way to build the complete function call of an arbitrary function? Here's what I want to do. A function will build a function which will itself call a probability density function for some law given in argument to the