Modifying a function programmatically
On Mon, Feb 4, 2013 at 5:00 AM, S?ren H?jsgaard <sorenh at 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 operation. Try: library(functional) ff1 <- Curry(ff, a = 1) # test identical(ff1(2, 4), ff(1, 2, 4)) # TRUE -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com