Plot the cumulative mean for a parameter
plot_cummean(
data,
var,
order_var = "iteration",
group = NULL,
use_facet = FALSE
)
A valid data frame containing scalar or time series values
from a ss3sim simulation. That data are generated from
get_results_all()
.
The column name of the parameter in data of which to plot cumulative mean. A string.
A column to order the data before calculating the cumulative mean
A column in data to group the data together before calculating the cumulative mean
Should the group be used to create facets? If TRUE, facets are created; If FALSE, grouping will be done by making different color lines in the same plot.
A list containing the ggplot object and the data used to make it
data("scalar_dat", package = "ss3sim")
obj <- plot_cummean(scalar_dat[scalar_dat$model_run == "em", ],
"VonBert_K_Fem_GP_1",
group = "scenario",
use_facet = TRUE
)
# obj$plot
# obj$data
rm(obj)
# group can also be left NULL if only plotting a single scenario.
# it is recommended to set use_facet FALSE in this case.
obj2 <- plot_cummean(
scalar_dat[
scalar_dat$scenario == unique(scalar_dat$scenario)[1] &
scalar_dat$model_run == "em",
],
var = "VonBert_K_Fem_GP_1",
group = NULL,
use_facet = FALSE
)
# obj2$plot
# obj2$data
rm(obj2)