View source: R/relabel_predictors.R
relabel_predictors | R Documentation |
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
relabel_predictors(x, ...)
x |
Either a tidy data frame to be passed to |
... |
Named replacements, as in |
The function returns an object of the same type as it is passed: a tidy data frame or a plot generated by dwplot
.
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.