fmt_regression: Turn a regression model object into a markdown-ready tibble.

Description Usage Arguments Examples

Description

This function uses broom::tidy from the broom or broom.mixed packages to perform the initial model formatting. Review the fmt_regression vignette for detailed examples.

Usage

1
2
3
4
fmt_regression(x, exponentiate = FALSE, label = NULL,
  include = names(stats::model.frame(x)), show_yesno = NULL,
  conf.level = 0.95, intercept = FALSE, beta_fun = fmt_beta,
  pvalue_fun = fmt_pvalue)

Arguments

x

regression model object

exponentiate

logical argument passed directly to tidy function Default is FALSE

label

list of labels to write in the output. list(age60 = "Age > 60")

include

names of variables to include in output. Default is all variables.

show_yesno

Vector of names of categorical and factor variables that are c("No", "Yes"), c("no", "yes"), or c("NO", "YES") default to dichotomous printing (i.e. only Yes shown). To force both levels to be shown include the column name in show_yesno, e.g. show_yesno = c("highgrade", "female")

conf.level

confidence level passed directly to tidy function. Default is 0.95.

intercept

logical argument indicates whether to include the intercept in the output. Default is FALSE

beta_fun

function to round and format beta coefficients. Default is fmt_beta

pvalue_fun

function to round and format p-values. Default is fmt_pvalue

Examples

1
2
3
4
5
6
7
8
9
mod1 <- lm(hp ~ mpg + factor(cyl), mtcars)
fmt_regression(mod1)

mod2 <- glm(response ~ age + grade + stage, trial, family = binomial(link = "logit"))
fmt_regression(mod2, exponentiate = TRUE)

library(lme4)
mod_glmer <- glmer(am ~ hp + (1 | gear), mtcars, family = binomial)
fmt_regression(mod_glmer, exponentiate = TRUE)

ddsjoberg/gtsummary-v0.1 documentation built on June 4, 2019, 7:48 a.m.