List higher order variables of a model

model_list_higher_order_variables(model)

# S3 method for default
model_list_higher_order_variables(model)

Arguments

model

a model object

Examples

lm(hp ~ mpg + factor(cyl) + disp:hp, mtcars) %>%
  model_list_higher_order_variables()
#> [1] "mpg"         "factor(cyl)" "hp:disp"    

mod <- glm(
  response ~ stage * grade + trt:stage,
  gtsummary::trial,
  family = binomial
)
mod %>% model_list_higher_order_variables()
#> [1] "stage:grade" "stage:trt"  

mod <- glm(
  Survived ~ Class * Age + Sex,
  data = Titanic %>% as.data.frame(),
  weights = Freq,
  family = binomial
)
mod %>% model_list_higher_order_variables()
#> [1] "Sex"       "Class:Age"