Skip to contents

Extract All Symbols from a List of Expressions

Usage

extract_vars(x, side = "lhs")

Arguments

x

An R object

side

One of "lhs" (the default) or "rhs" for formulas

Value

A list of expressions

See also

Examples

library(rlang)
extract_vars(exprs(PARAMCD, (BASE - AVAL) / BASE + 100))
#> [[1]]
#> PARAMCD
#> 
#> [[2]]
#> BASE
#> 
#> [[3]]
#> AVAL
#> 
extract_vars(AVAL ~ ARMCD + AGEGR1)
#> [[1]]
#> AVAL
#> 
extract_vars(AVAL ~ ARMCD + AGEGR1, side = "rhs")
#> [[1]]
#> ARMCD
#> 
#> [[2]]
#> AGEGR1
#>