Produce a coefficient and plot from a lm()
model.
coefficient_plot(
.data,
dependent,
explanatory,
random_effect = NULL,
factorlist = NULL,
lmfit = NULL,
confint_type = "default",
confint_level = 0.95,
remove_ref = FALSE,
breaks = NULL,
column_space = c(-0.5, -0.1, 0.5),
dependent_label = NULL,
prefix = "",
suffix = NULL,
table_text_size = 4,
title_text_size = 13,
plot_opts = NULL,
table_opts = NULL,
...
)
Dataframe.
Character vector of length 1: name of depdendent variable (must be numeric/continuous).
Character vector of any length: name(s) of explanatory variables.
Character vector of length 1, name of random effect variable.
Option to provide output directly from
summary_factorlist()
.
Option to provide output directly from lmmulti()
and lmmixed()
.
For for lmer
models, one of c("default",
"Wald", "profile", "boot")
Note "default" == "Wald".
The confidence level required.
Logical. Remove reference level for factors.
Manually specify x-axis breaks in format c(0.1, 1, 10)
.
Adjust table column spacing.
Main label for plot.
Plots are titled by default with the dependent variable. This adds text before that label.
Plots are titled with the dependent variable. This adds text after that label.
Alter font size of table text.
Alter font size of title text.
A list of arguments to be appended to the ggplot call by "+".
A list of arguments to be appended to the ggplot table call by "+".
Other parameters.
Returns a table and plot produced in ggplot2
.
library(finalfit)
library(ggplot2)
# Coefficient plot
explanatory = c("age.factor", "sex.factor", "obstruct.factor", "perfor.factor")
dependent = "nodes"
colon_s %>%
coefficient_plot(dependent, explanatory)
#> Note: dependent includes missing data. These are dropped.
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
#> Warning: Removed 9 rows containing missing values (`geom_errorbarh()`).
colon_s %>%
coefficient_plot(dependent, explanatory, table_text_size=4, title_text_size=14,
plot_opts=list(xlab("Beta, 95% CI"), theme(axis.title = element_text(size=12))))
#> Note: dependent includes missing data. These are dropped.
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
#> Warning: Removed 9 rows containing missing values (`geom_errorbarh()`).