search for: make_fn_1

Displaying 1 result from an estimated 1 matches for "make_fn_1".

Did you mean: make_fn_2
2017 Aug 04
2
Why is as.function() slower than eval(call("function"())?
(Apologies if this is better suited for R-help.) On my system (macOS Sierra, late 2014 MacBook Pro; R 3.4.1, Homebrew build), I found that it is faster to construct a function using eval(call("function", ...)) than using as.function(list(...)). Example: make_fn_1 <- function(a, b) eval(call("function", a, b), env = parent.frame()) make_fn_2 <- function(a, b) as.function(c(a, list(b)), env = parent.frame()) a <- as.pairlist(alist(x = , y = )) b <- quote(x + y) library("microbenchmark") microbenchmark(make...