relabel_predictors {dotwhisker} | R Documentation |
Relabel the Predictors in a Tidy Data Frame of Regression Results
Description
relabel_predictors
is a convenience function for relabeling the predictors in a tidy data frame to be passed to dwplot
or a plot generated by dwplot
Usage
relabel_predictors(x, ...)
Arguments
x |
Either a tidy data frame to be passed to |
... |
Named replacements, as in |
Value
The function returns an object of the same type as it is passed: a tidy data frame or a plot generated by dwplot
.
Examples
library(broom)
library(dplyr)
data(mtcars)
m1 <- lm(mpg ~ wt + cyl + disp, data = mtcars)
m1_df <- broom::tidy(m1) %>%
relabel_predictors("(Intercept)" = "Intercept",
wt = "Weight",
disp = "Displacement",
cyl = "Cylinder")
dwplot(m1_df)
dwplot(m1, show_intercept = TRUE) %>%
relabel_predictors("(Intercept)" = "Intercept",
wt = "Weight",
disp = "Displacement",
cyl = "Cylinder")
[Package dotwhisker version 0.8.2 Index]