Displaying 1 result from an estimated 1 matches for "xcupofcofee".
Did you mean:
acupofcofee
2004 Sep 29
2
defining a template for functions via do.call and substit ute.
Here's one not-so-straightforward way:
> f <- function(a, b) a + b
> flist <- as.list(f)
> names(flist)[1:2] <- c("x", "y")
> flist[[3]] <- do.call("substitute", list(body(f), list(a=as.name("x"),
b=as.name("y"))))
> g <- as.function(flist)
> g
function (x, y)
x + y
HTH,
Andy
> From: john.gavin at ubs.com