polish: Tidy and put the finishing touches on a model output

View source: R/polish.R

polishR Documentation

Tidy and put the finishing touches on a model output

Description

Wrapper around broom::tidy() with some additional finishing touches!

Usage

polish(
  x,
  .labels = NULL,
  .conf_int = TRUE,
  .flextable = TRUE,
  .header1 = NULL,
  .header2 = NULL,
  ...
)

Arguments

x

A model object to be converted into a tibble::tibble()

.labels

A named list of variable labels. If NULL, current labels will be used

.conf_int

Logical to return a 95 percent confidence interval

.flextable

Logical to return a formatted flextable object if TRUE or a list of a dataframe and row numbers to use in flextable::padding()

.header1

See ??mRclwhip::format_flextable for details

.header2

See ??mRclwhip::format_flextable for details

...

additional arguments passed to broom::tidy()

Examples

df1 <- tibble::tibble(
  id = letters,
  age = sample(seq(18, 39, 1), 26, replace = TRUE),
  mile_time = sample(seq(6, 7.5, 0.1), 26, replace = TRUE),
  gender = sample(c("Male", "Female"), 26, replace = TRUE),
  country = sample(c("USA", "Canada", "Africa", "England"), 26, replace = TRUE)
)

lm_res <- lm(mile_time ~ age + gender + country, data = df1)

lm_res %>%
  polish(
    .labels = c(age = "Age", gender = "Gender", country = "Country of origin"),
    .header1 = list(values = c("", "Estimate (95% CI)"))
    )

overdodactyl/mRclwhip documentation built on June 30, 2023, 6:24 a.m.