R: Extract function from a call

lang_fn {rlang} | R Documentation

## 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

    # Extract from a quoted call:
    lang_fn(~matrix())
    lang_fn(quote(matrix()))

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

[Package rlang version 0.1.6 Index]