easystats / easystats/parameters

`modelsummary`'s `coef_rename` doesn't work with `avg_comparisons`

Open
#1,238 0 comments 0 reactions 1 assignee View on GitHub

@strengejacke is already working on this.

Since Jul 4, 2026.

3 investigators :grey_question::question: Enhancement :boom:
Dominant language
R
Stars
499
Forks
45
Avg merge
3d 1h
Merged PRs (30d)
3

Description

Consider the following example:

tmp <- mtcars
tmp %<>% mutate(across(cyl, as.factor))
tmp <- set_variable_labels(
  tmp,
  mpg = "Miles per gallon",
  cyl = "Number of cylinders",
  disp = "Displacement"
)
attr(tmp$am, "label")
mod <- lm(mpg ~ cyl + disp, tmp)
modelsummary(dvnames(mod), coef_rename=TRUE)

mod_ame <- avg_comparisons(mod, variables = list(cyl = "reference"))
modelsummary(dvnames(mod_ame), shape=term+contrast~model, coef_rename=TRUE)

which prints:

Image

The labels are lost for both the dependent and the independent variable.

Reported here as per https://github.com/vincentarelbundock/modelsummary/issues/966#issuecomment-4866327066

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.