Rename model terms
A convenience function which can be passed to the coef_rename
argument of the modelsummary
function.
coef_rename( x, factor = TRUE, factor_name = TRUE, poly = TRUE, backticks = TRUE, titlecase = TRUE, underscore = TRUE, asis = TRUE )
x
: character vector of term names to transformfactor
: boolean remove the "factor()" labelfactor_name
: boolean remove the "factor()" label and the name of the variablepoly
: boolean remove the "poly()" label and function argumentsbackticks
: boolean remove backtickstitlecase
: boolean convert to title caseunderscore
: boolean replace underscores by spacesasis
: boolean remove the I
from as-is formula callslibrary(modelsummary)
dat <- mtcars
dat$horse_power <- dat$hp
mod <- lm(mpg ~ horse_power + factor(cyl), dat)
modelsummary(mod, coef_rename = coef_rename)