f_modify_formula {autostats}R Documentation

Modify Formula

Description

Modify components of a formula by adding / removing vars from the rhs or replacing the lhs.

Usage

f_modify_formula(
  f,
  rhs_remove = NULL,
  rhs_add = NULL,
  lhs_replace = NULL,
  negate = TRUE
)

Arguments

f

formula

rhs_remove

regex or character vector for dropping variables from the rhs

rhs_add

character vector for adding variables to rhs

lhs_replace

string to replace formula lhs if supplied

negate

should rhs_remove keep or remove the specified vars. Set to FALSE to keep

Value

formula

Examples


iris %>%
tidy_formula(target = Species, tidyselect::everything()) -> f

f

f %>%
  f_modify_formula(
rhs_remove = c("Petal.Width", "Sepal.Length"),
rhs_add = "Custom_Variable"
)

f %>%
  f_modify_formula(
rhs_remove = "Petal",
lhs_replace = "Petal.Length"
)

[Package autostats version 0.3.0 Index]