Skip to content

Instantly share code, notes, and snippets.

@mweylandt
Created January 16, 2024 15:34
Show Gist options
  • Save mweylandt/167f3342e569d5da7ce274cf8cdf3e52 to your computer and use it in GitHub Desktop.
Save mweylandt/167f3342e569d5da7ce274cf8cdf3e52 to your computer and use it in GitHub Desktop.
Omit interactions from modelsummary tables
co <- ":" # omit all interactions
co3 <- ":.*:" # omit three way interactions and higher
co4 <- ":.*:.*:.*" #omit four-way interactions
mod <- lm(mpg ~ hp*am*wt*cyl,data = mtcars)
modelsummary(mod, coef_omit = co )
modelsummary(mod, coef_omit = co3 )
modelsummary(mod, coef_omit = co4 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment