Learn R Programming

SSBtools (version 1.5.4)

formula_include_hierarchies: Replace variables in formula with sum of other variables

Description

Replace variables in formula with sum of other variables

Usage

formula_include_hierarchies(
  f,
  hier_vars,
  simplify = TRUE,
  env = parent.frame()
)

Value

model formula

Arguments

f

model formula

hier_vars

named list. the names of hier_vars must correspond to variables in f. Each element in hier_vars must be a character vector consisting of those variables you wish to replace

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
f2 <- formula_from_vars(c("a", "b", "c"), c("a", "c"))
formula_include_hierarchies(f2, list(a = c("hello", "world")),
simplify = FALSE)

Run the code above in your browser using DataLab