search for: make_fn_2

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

Did you mean: make_fn_1
2017 Aug 04
2
Why is as.function() slower than eval(call("function"())?
...cOS 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_fn_1(a, b), make_fn_2(a, b)) # Unit: microseconds # expr min lq m...