clean_glm: Create a Clean Summary Table from a glm Object

Description Usage Arguments Value Examples

View source: R/clean_glm.R

Description

Formats a glm object for printing to console or inputting to kable.

Usage

1
2
3
4
5
6
7
8
9
clean_glm(
  fit,
  columns = NULL,
  expand_factors = TRUE,
  variable_labels = NULL,
  prep_kable = FALSE,
  decimals = 2,
  formatp_list = NULL
)

Arguments

fit

Object returned from glm.

columns

Character vector specifying what columns to include. Choices for each element are "beta", "se", "betaci", "beta_se", "beta_ci" "or", "orci", "or_ci", "hr", "hrci", "hr_ci"), "z", "t", and "p".

expand_factors

Logical value for whether to include two blank rows for factor variables (name of variable and reference group).

variable_labels

Character vector in case you want labels other than the variable names.

prep_kable

Logical value for whether to prepare for printing via kable. Right now, it just adds forward slashes so factor levels are indented, which only applies if there are factor variables and expand_factors = TRUE.

decimals

Numeric value of vector specifying number of decimal places for each column.

formatp_list

Arguments to pass to formatp.

Value

Data frame.

Examples

1
2
3
fit <- glm(mpg ~ wt + as.factor(cyl) + hp, data = mtcars)
clean_glm(fit)
fit %>% clean_glm(prep_kable = TRUE) %>% knitr::kable()

vandomed/dvmisc documentation built on Oct. 2, 2020, 9:50 p.m.