Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

tidy_disambiguate_terms

Disambiguate terms


Description

For mixed models, the term column returned by broom.mixed may have duplicated values for random-effect parameters and random-effect values. In such case, the terms could be disambiguated be prefixing them with the value of the group column. tidy_disambiguate_terms() will not change any term if there is no group column in x. The original term value is kept in a new column original_term.

Usage

tidy_disambiguate_terms(x, sep = ".", model = tidy_get_model(x), quiet = FALSE)

Arguments

x

a tidy tibble

sep

character, separator added between group name and term

model

the corresponding model, if not attached to x

quiet

logical argument whether broom.helpers should not return a message when requested output cannot be generated. Default is FALSE

See Also

Examples

if (require(lme4) & require(broom.mixed) & require(gtsummary)) {
  mod <- lme4::lmer(marker ~ stage + (1|grade) + (death|response), trial)
  mod %>% tidy_and_attach() %>% tidy_disambiguate_terms()
}

broom.helpers

Helpers for Model Coefficients Tibbles

v1.3.0
GPL-3
Authors
Joseph Larmarange [aut, cre] (<https://orcid.org/0000-0001-7097-700X>), Daniel D. Sjoberg [aut] (<https://orcid.org/0000-0003-0862-2018>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.