get_vars: Get formula variables

Description Usage Arguments Value See Also Examples

Description

The function get_vars extracts variable names from a formula.

Usage

1

Arguments

formula

a formula.

data

data.frame or matrix. If not NULL, formulas with a dot . are permitted.

intersection

logical. If TRUE and data is not NULL, the intersection between variables found in the formula and data column names is returned.

Value

a character vector, the variables found.

See Also

all.vars, get.vars

Examples

1
2
3
4
5
6
7
get_vars(y ~ x1 + x2 - x1)
get_vars(y ~ . - x1, data = data.frame(y = 1, x1 = 2, x2 = 3))
get_vars(y + z ~ x1 + x2 - x1 | x3)
get_vars(y ~ x1 + I(log(x2)))
get_vars(y ~ x1*x2)
get_vars(y ~ x1:x2)
get_vars(~ x1 + x2)

bazar documentation built on May 2, 2019, 7:02 a.m.