View source: R/adorn-reg-table-format.R
adorn_reg_table_format | R Documentation |
Add formatting to a table of regression results....
adorn_reg_table_format(
tab,
digits = 2,
pval_fmt = "combo",
format = "html",
separate_text = " to ",
var_labels = NULL
)
tab |
A regression table. Data frame or tibble |
digits |
Integer; number of digits to display (default is 2) |
pval_fmt |
Which p-value to show. Options are (1) "combo", default, which shows the LRT and Wald but only if there is more than one level, (2) "all" shows LRT and Wald no matter what, (3) "lrt" shows just the LRT p-value, (4) "wald" shows just the Wald p-value. |
format |
Doesn't do anything right now. Place holder for later. Default is "html". |
separate_text |
Text to use in confidence intervals. Default is " to ". |
var_labels |
Variable labels |
A tibble or data frame
## Not run:
library(epiDisplay)
library(tidyverse)
dplyr::glimpse(infert)
model0 <- glm(case ~ induced + spontaneous + education,
family = binomial,
data = infert)
tab1 <- display_logistic(fit = model0,
data = infert)
adorn_reg_table_format(tab1,
pval_fmt = "all")
adorn_reg_table_format(tab1,
pval_fmt = "combo")
adorn_reg_table_format(tab1,
pval_fmt = "combo")
tab2 <- display_logistic(fit = model0,
data = infert,
add_multi = TRUE)
adorn_reg_table_format(tab2,
pval_fmt = "combo")
# How does an interaction term work?
# This sort of works right now, but still needs work (2019-03-23)
# Does't work very well with the multivariable results
model0 <- glm(case ~ induced * education,
family = binomial,
data = infert)
tab3 <- display_logistic(fit = model0,
data = infert,
add_multi = FALSE)
adorn_reg_table_format(tab3,
pval_fmt = "all")
display_logistic(fit = model0,
data = infert,
add_multi = TRUE) %>%
adorn_reg_table_format(.,
pval_fmt = "combo") %>%
print(n = Inf)
## With labels ----------------
model0 <- glm(case ~ induced + spontaneous + education,
family = binomial,
data = infert)
tab4 <- display_logistic(fit = model0,
data = infert,
add_multi = TRUE)
adorn_reg_table_format(tab4,
pval_fmt = "combo",
var_labels = list(induced = "Induced (1/0)",
spontaneous = "Spontaneous (1/0)",
education = "Education levels"))
# Another way if the data set is already labelled
labelled::var_label(infert) <- list(induced = "Induced (1/0)",
spontaneous = "Spontaneous (1/0)",
education = "Education levels")
adorn_reg_table_format(tab4,
pval_fmt = "combo",
var_labels = labelled::var_label(infert))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.