coef_rename function

Rename model terms

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 )

Arguments

  • x: character vector of term names to transform
  • factor: boolean remove the "factor()" label
  • factor_name: boolean remove the "factor()" label and the name of the variable
  • poly: boolean remove the "poly()" label and function arguments
  • backticks: boolean remove backticks
  • titlecase: boolean convert to title case
  • underscore: boolean replace underscores by spaces
  • asis: boolean remove the I from as-is formula calls

Examples

library(modelsummary)
dat <- mtcars
dat$horse_power <- dat$hp
mod <- lm(mpg ~ horse_power + factor(cyl), dat)
modelsummary(mod, coef_rename = coef_rename)
  • Maintainer: Vincent Arel-Bundock
  • License: GPL-3
  • Last published: 2025-02-02