plot_pred | R Documentation |
Plot the predictor matrix of an imputation model
plot_pred(
data,
vrb = "all",
method = NULL,
label = TRUE,
square = TRUE,
rotate = FALSE
)
data |
A predictor matrix for |
vrb |
String, vector, or unquoted expression with variable name(s), default is "all". |
method |
Character string or vector with imputation methods. |
label |
Logical indicating whether predictor matrix values should be displayed. |
square |
Logical indicating whether the plot tiles should be squares. |
rotate |
Logical indicating whether the variable name labels should be rotated 90 degrees. |
An object of class ggplot2::ggplot
.
# generate a predictor matrix
pred <- mice::quickpred(mice::nhanes)
# plot predictor matrix for all columns
plot_pred(pred)
# plot predictor matrix for specific columns by supplying a character vector
plot_pred(pred, c("chl", "hyp"))
# plot predictor matrix for specific columns by supplying unquoted variable names
plot_pred(pred, c(chl, hyp))
# plot predictor matrix for specific columns by passing an object with variable names
# from the environment, unquoted with `!!`
my_variables <- c("chl", "hyp")
plot_pred(pred, !!my_variables)
# object with variable names must be unquoted with `!!`
try(plot_pred(pred, my_variables))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.