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

tidy_attach_model

Attach a full model to the tibble of model terms


Description

To facilitate the use of broom helpers with pipe, it is recommended to attach the original model as an attribute to the tibble of model terms generated by broom::tidy().

Usage

tidy_attach_model(x, model, .attributes = NULL)

tidy_and_attach(
  model,
  tidy_fun = tidy_with_broom_or_parameters,
  exponentiate = FALSE,
  ...
)

tidy_get_model(x)

tidy_detach_model(x)

Arguments

x

a tibble of model terms

model

a model to be attached/tidied

.attributes

named list of additional attributes to be attached to x

tidy_fun

option to specify a custom tidier function

exponentiate

logical indicating whether or not to exponentiate the coefficient estimates. This is typical for logistic, Poisson and Cox models, but a bad idea if there is no log or logit link; defaults to FALSE

...

other arguments passed to tidy_fun()

Details

tidy_attach_model() attach the model to a tibble already generated while tidy_and_attach() will apply broom::tidy() and attach the model.

Use tidy_get_model() to get the model attached to the tibble and tidy_detach_model() to remove the attribute containing the model.

See Also

Examples

mod <- lm(Sepal.Length ~ Sepal.Width + Species, data = iris)
tt <- mod %>%
  tidy_and_attach(conf.int = TRUE)
tt
tidy_get_model(tt)

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.