rlang (version 0.1)

lang_fn: Extract function from a call

Description

If a frame or formula, the function will be retrieved from the associated environment. Otherwise, it is looked up in the calling frame.

Usage

lang_fn(lang)

Arguments

lang

Can be a call (language object), a formula quoting a call in the right-hand side, or a frame object from which to extract the call expression.

See Also

lang_name()

Examples

Run this code
# NOT RUN {
# Extract from a quoted call:
lang_fn(~matrix())
lang_fn(quote(matrix()))

# Extract the calling function
test <- function() lang_fn(call_frame())
test()
# }

Run the code above in your browser using DataCamp Workspace