Learn R Programming

speccurvieR (version 1.0.0)

plot_vars: Plots the variables in each model.

Description

plot_vars() plots the variables included in each model specification in order of model index. Returns a ggplot object that can then be combined with the output of other functions like plot_rmse() if further customization of each plot is desired.

Usage

plot_vars(sca_data, title = "", color_controls = FALSE)

Value

A ggplot object.

Arguments

sca_data

A data frame returned by `sca()` containing model estimates from the specification curve analysis.

title

A string to use as the plot title. Defaults to an empty string, `""`.

color_controls

A boolean indicating whether to give each variable a color to improve readability. Defaults to `FALSE`.

Examples

Run this code
plot_vars(sca_data = sca(y = "Salnty", x = "T_degC",
                        controls = c("ChlorA", "O2Sat"),
                        data = bottles, progress_bar = TRUE,
                        parallel = FALSE),
                     title = "Model Variable Specifications");
plot_vars(sca_data = sca(y = "Salnty", x = "T_degC",
                        controls = c("ChlorA*O2Sat"),
                        data = bottles, progress_bar = FALSE,
                        parallel = FALSE),
                     color_controls = TRUE);
# \donttest{
plot_vars(sca_data = sca(y = "Salnty", x = "T_degC",
                        controls = c("ChlorA*NO3uM", "O2Sat*NO3uM"),
                        data = bottles,
                        progress_bar = TRUE, parallel = TRUE, workers = 2));
# }

Run the code above in your browser using DataLab