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 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 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.