Generate model formula by specifying which variables have totals or not.
Source:R/formula_utils.R
formula_from_vars.Rd
Generate model formula by specifying which variables have totals or not.
Usage
formula_from_vars(
nontotal_vars = NULL,
total_vars = NULL,
simplify = TRUE,
env = parent.frame()
)
Examples
formula_from_vars(c("a", "b", "c"), c("a"))
#> ~b:c + a:b:c
#> <environment: 0x5582440fc0f0>
formula_from_vars(c("a", "b", "c"), c("a", "c"))
#> ~b + b:c + a:b + a:b:c
#> <environment: 0x5582440fc0f0>
formula_from_vars(c("a", "b", "c"), c("a", "b", "c"))
#> ~a * b * c
#> <environment: 0x5582440fc0f0>
formula_from_vars(c("a", "b", "c"), NULL)
#> ~a:b:c
#> <environment: 0x5582440fc0f0>
formula_from_vars(NULL, c("a", "b", "c"))
#> ~a * b * c
#> <environment: 0x5582440fc0f0>
formula_from_vars(c("a", "b"), c("d"))
#> ~a:b + a:b:d
#> <environment: 0x5582440fc0f0>