or_plot | R Documentation |
Produce an odds ratio table and plot from a glm()
or
lme4::glmer()
model.
or_plot(
.data,
dependent,
explanatory,
random_effect = NULL,
factorlist = NULL,
glmfit = NULL,
confint_type = NULL,
confint_level = 0.95,
remove_ref = FALSE,
breaks = NULL,
column_space = c(-0.5, 0, 0.5),
dependent_label = NULL,
prefix = "",
suffix = NULL,
table_text_size = 4,
title_text_size = 13,
plot_opts = NULL,
table_opts = NULL,
...
)
.data |
Data frame. |
dependent |
Character vector of length 1: name of depdendent variable (must have 2 levels). |
explanatory |
Character vector of any length: name(s) of explanatory variables. |
random_effect |
Character vector of length 1, name of random effect variable. |
factorlist |
Option to provide output directly from
|
glmfit |
Option to provide output directly from |
confint_type |
One of |
confint_level |
The confidence level required. |
remove_ref |
Logical. Remove reference level for factors. |
breaks |
Manually specify x-axis breaks in format |
column_space |
Adjust table column spacing. |
dependent_label |
Main label for plot. |
prefix |
Plots are titled by default with the dependent variable. This adds text before that label. |
suffix |
Plots are titled with the dependent variable. This adds text after that label. |
table_text_size |
Alter font size of table text. |
title_text_size |
Alter font size of title text. |
plot_opts |
A list of arguments to be appended to the ggplot call by "+". |
table_opts |
A list of arguments to be appended to the ggplot table call by "+". |
... |
Other parameters. |
Returns a table and plot produced in ggplot2
.
Other finalfit plot functions:
coefficient_plot()
,
ff_plot()
,
hr_plot()
,
surv_plot()
library(finalfit)
library(dplyr)
library(ggplot2)
# OR plot
explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor")
dependent = "mort_5yr"
colon_s %>%
or_plot(dependent, explanatory)
colon_s %>%
or_plot(dependent, explanatory, table_text_size=4, title_text_size=14,
plot_opts=list(xlab("OR, 95% CI"), theme(axis.title = element_text(size=12))))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.