formula_include_hierarchies: Replace variables in formula with sum of other variables

View source: R/formula_utils.R

formula_include_hierarchiesR Documentation

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

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

Value

model formula

Author(s)

Daniel Lupp

Examples

f2 <- formula_from_vars(c("a", "b", "c"), c("a", "c"))
formula_include_hierarchies(f2, list(a = c("hello", "world")),
simplify = FALSE)

SSBtools documentation built on Oct. 30, 2024, 5:09 p.m.