[R] Modifying a function programmatically

2013-02-04 Thread Søren Højsgaard
Dear list # I have a function ff - function(a,b=2,c=4){a+b+c} # which I programmatically want to modify to a more specialized function in which a is replaced by 1 ff1 - function(b=2,c=4){1+b+c} # I do as follows: vals - list(a=1) (expr1 - as.expression(body(ff))) expression({ a + b +

Re: [R] Modifying a function programmatically

2013-02-04 Thread Pascal Oettli
Hi, Is it what you are looking for? ff - function(a,b,c){a+b+c} ff(1,10,12) [1] 23 ff(589,2,4) [1] 595 HTH, Pascal Le 04/02/2013 19:00, Søren Højsgaard a écrit : Dear list # I have a function ff - function(a,b=2,c=4){a+b+c} # which I programmatically want to modify to a more

Re: [R] Modifying a function programmatically

2013-02-04 Thread Søren Højsgaard
] Sent: 4. februar 2013 11:11 To: Søren Højsgaard Cc: r-help@r-project.org Subject: Re: [R] Modifying a function programmatically Hi, Is it what you are looking for? ff - function(a,b,c){a+b+c} ff(1,10,12) [1] 23 ff(589,2,4) [1] 595 HTH, Pascal Le 04/02/2013 19:00, Søren Højsgaard a écrit

Re: [R] Modifying a function programmatically

2013-02-04 Thread Gabor Grothendieck
On Mon, Feb 4, 2013 at 5:00 AM, Søren Højsgaard sor...@math.aau.dk wrote: Dear list # I have a function ff - function(a,b=2,c=4){a+b+c} # which I programmatically want to modify to a more specialized function in which a is replaced by 1 ff1 - function(b=2,c=4){1+b+c} This a currying

Re: [R] Modifying a function programmatically

2013-02-04 Thread Søren Højsgaard
] Sent: 4. februar 2013 17:31 To: Søren Højsgaard Cc: r-help@r-project.org Subject: Re: [R] Modifying a function programmatically On Mon, Feb 4, 2013 at 5:00 AM, Søren Højsgaard sor...@math.aau.dk wrote: Dear list # I have a function ff - function(a,b=2,c=4){a+b+c} # which I programmatically