Learn R Programming

SSBtools (version 1.7.0)

formula_from_vars: Generate model formula by specifying which variables have totals or not.

Description

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()
)

Value

model formula

Arguments

nontotal_vars

character vector of the variable names without totals

total_vars

character vector of the variable names with totals

simplify

logical value, default TRUE. Determines whether the formula should be simplified before output or not.

env

the environment for the output formula

Author

Daniel Lupp

Examples

Run this code
formula_from_vars(c("a", "b", "c"), c("a"))
formula_from_vars(c("a", "b", "c"), c("a", "c"))
formula_from_vars(c("a", "b", "c"), c("a", "b", "c"))
formula_from_vars(c("a", "b", "c"), NULL)
formula_from_vars(NULL, c("a", "b", "c"))
formula_from_vars(c("a", "b"), c("d"))

Run the code above in your browser using DataLab