Søren
-Original Message-
From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com]
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 wrote:
> Dear list
&g
On Mon, Feb 4, 2013 at 5:00 AM, Søren Højsgaard 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 operation.
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 é
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 s
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 +
5 matches
Mail list logo