I have been reading the Functionals from github. One suggestion in the page was to use call_function if one is working with a list of functions. Here is the code from the page:
call_fun <- function(f, ...) f(...)
f <- list(sum, mean, median, sd)
lapply(f, call_fun, x = runif(1e3))
The output was posted as:
# [[1]]
# [1] 498
#
# [[2]]
# [1] 0.498
#
# [[3]]
# [1] 0.49
#
# [[4]]
# [1] 0.29
However, I was not able to replicate the above results. I got the error:
Error in FUN(X[[4L]], ...) : could not find function "f"
Am I missing something here?