Description Usage Arguments Value Examples
View source: R/displaylogistic2.R
Given a string with an "outcome" and a vector string with "predictors", univariable and (optionally) multivariable results from logistic regression are displayed in a format suitable for presentation.
This version allows you to explicitly provide the outcome and predictors in case there are issues with getting a full model fit.
1 2 3 4 5 6 7 8 9 10 11 
data 
A tibble or data frame with the full data set. 
outcome 
Character string. The dependent variable (outcome) for logistic regression. 
predictors 
Character vector. Independent variables (predictors/covariates) for univariable and/or multivariable modelling. 
ref_level 
Character string. The factor level of outcome variable that
corresponds to the true condition (1). If not provided then default is

add_multi 
Logical; include multivariable results. Default is 
format 
Display format in case I need to escape some characters. A place holder for now in case I need it in the future. Default is "html". 
conf_level 
The confidence level to use for the confidence interval. Must be strictly greater than 0 and less than 1. Defaults to 0.95, which corresponds to a 95 percent confidence interval. 
exponentiate 
Logical indicating whether or not to exponentiate the
the coefficient estimates. This is typical for logistic and multinomial
regressions, but a bad idea if there is no log or logit link. Defaults to

include_last_row 
Adds a row at the end of each set of results to give
some breathing room. Default is 
A tibble
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39  ## Not run:
library(epiDisplay)
library(tidyverse)
dplyr::glimpse(infert)
case ~ induced + spontaneous + education
display_logistic2(data = infert,
outcome = "case",
predictors = c("induced", "spontaneous", "education"))
display_logistic2(data = infert,
outcome = "case",
predictors = c("induced", "spontaneous", "education"),
add_multi = TRUE)
# How does an interaction term work?
# Doesn't work yet (20190323)
# display_logistic2(data = infert,
# outcome = "case",
# predictors = c("induced * education"))
#### Another data set 
library(compareGroups)
data(predimed)
dplyr::glimpse(predimed)
predimed < predimed %>%
mutate_if(is.double, as.double)
fit = glm(htn ~ sex + bmi + smoke,
family = binomial(link = "logit"),
data = predimed)
display_logistic2(data = predimed,
outcome = "htn",
predictors = c("sex", "bmi", "smoke"),
add_multi = TRUE)
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.