Generates a list of scenarios by expanding combinations of regular parameters and preserving grouped parameters that must vary together.
scenario_list(..., each = 1)Named arguments defining parameters. Arguments may be regular
vectors or grouped_params objects created with grouped.
Integer representing the number of replications for each scenario or set of parameters. Defaults to 1.
A list of scenarios, where each element is a one-row data.frame
of parameter values with an added element scenario giving the scenario index.
grouped for creating grouped parameter objects.
# Regular parameters
s1 <- scenario_list(a = 1:2, b = c("x", "y"))
# Grouped parameters
g <- grouped(x = 1:2, y = c(10, 20))
s2 <- scenario_list(a = c("low", "high"), g, each = 3)
# Inspect first few scenarios
head(s1)
#> [[1]]
#> a b scenario
#> 1 1 x 1
#>
#> [[2]]
#> a b scenario
#> 2 2 x 2
#>
#> [[3]]
#> a b scenario
#> 3 1 y 3
#>
#> [[4]]
#> a b scenario
#> 4 2 y 4
#>
head(s2)
#> [[1]]
#> a x y scenario
#> 1 low 1 10 1
#>
#> [[2]]
#> a x y scenario
#> 1 low 1 10 1
#>
#> [[3]]
#> a x y scenario
#> 1 low 1 10 1
#>
#> [[4]]
#> a x y scenario
#> 2 high 1 10 2
#>
#> [[5]]
#> a x y scenario
#> 2 high 1 10 2
#>
#> [[6]]
#> a x y scenario
#> 2 high 1 10 2
#>