plot_trace | R Documentation |
Plot the trace lines of the imputation algorithm
plot_trace(data, vrb = "all")
data |
An object of class mice::mids. |
vrb |
String, vector, or unquoted expression with variable name(s), default is "all". |
The vrb
argument is "quoted" via rlang::enexpr()
and evaluated according
to tidy evaluation principles.
In practice, this technical nuance only affects users when passing an object
from the environment (e.g., a vector of variable names) to the vrb
argument.
In such cases, the object must be "unquoted" via the !!
prefix operator.
An object of class ggplot2::ggplot.
# create [mice::mids] object with [mice::mice()]
imp <- mice::mice(mice::nhanes, print = FALSE)
# plot trace lines for all imputed columns
plot_trace(imp)
# plot trace lines for specific columns by supplying a string or character vector
plot_trace(imp, "chl")
plot_trace(imp, c("chl", "hyp"))
# plot trace lines for specific columns by supplying unquoted variable names
plot_trace(imp, chl)
plot_trace(imp, c(chl, hyp))
# plot trace lines for specific columns by passing an object with variable names
# from the environment, unquoted with `!!`
my_variables <- c("chl", "hyp")
plot_trace(imp, !!my_variables)
# object with variable names must be unquoted with `!!`
try(plot_trace(imp, my_variables))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.