Skip to contents

Given a formula() f, returns all variables used on the left-hand side and right-hand side of the formula.

Usage

extract_vars(f)

Arguments

f

(formula()).

Value

(list()) with elements "lhs" and "rhs", both character().

Examples

extract_vars(Species ~ Sepal.Width + Sepal.Length)
#> $lhs
#> [1] "Species"
#> 
#> $rhs
#> [1] "Sepal.Width"  "Sepal.Length"
#> 
extract_vars(Species ~ .)
#> $lhs
#> [1] "Species"
#> 
#> $rhs
#> [1] "."
#>