If a frame or formula, the function will be retrieved from the associated environment. Otherwise, it is looked up in the calling frame.
call_fn(call, env = caller_env())
Can be a call or a quosure that wraps a call.
The environment where to find the definition of the
function quoted in call
in case call
is not wrapped in a
quosure.
In rlang 0.2.0, lang_fn()
was soft-deprecated and renamed to
call_fn()
. See lifecycle section in call2()
for more about this
change.
# NOT RUN {
# Extract from a quoted call:
call_fn(quote(matrix()))
call_fn(quo(matrix()))
# Extract the calling function
test <- function() call_fn(call_frame())
test()
# }
Run the code above in your browser using DataLab