Base R do.call

do.call(what, args)

  • what is a function to call
  • args is a list of arguments to pass to the function.
nrow(mtcars)
#> [1] 32
mtcars3 <- do.call("rbind", list(mtcars, mtcars, mtcars))
nrow(mtcars3)
#> [1] 96

Exercise 19.5.5 #1

One way to implement exec is shown here: Describe how it works. What are the key ideas?

exec_ <- function(f, ..., .env = caller_env()){
  args <- list2(...)
  do.call(f, args, envir  = .env)
}