{casteval}
allows plotting of forecasts with up to 2 groups.
This function checks that at most 2 group columns in a given forecast data frame
have more than one value in them.
Examples
# no groups
casteval:::validate_plotting_groups(data.frame(time=1, val=2))
# 2 significant groups (with more than one value)
casteval:::validate_plotting_groups(data.frame(time=1:3, val=4:6, grp_var=7:9, grp_loc=8:10))
# 3 significant groups
try(
casteval:::validate_plotting_groups(
data.frame(time=1:3, val=4:6, grp_var=7:9, grp_loc=10:12, grp_sce=13:15)
)
)
#> Error in casteval:::validate_plotting_groups(data.frame(time = 1:3, val = 4:6, :
#> more than 2 groups contain multiple values: grp_var, grp_loc, grp_sce. See `vignette("casteval")` for details on plotting with groups.
# 2 significant groups (grp_loc has only one value)
casteval:::validate_plotting_groups(
data.frame(time=1:3, val=4:6, grp_var=7:9, grp_loc=c(1,1,1), grp_sce=13:15)
)