Generates a list of scenarios by expanding combinations of regular parameters and preserving grouped parameters that must vary together.

scenario_list(..., each = 1)

Arguments

...

Named arguments defining parameters. Arguments may be regular vectors or grouped_params objects created with grouped.

each

Integer representing the number of replications for each scenario or set of parameters. Defaults to 1.

Value

A list of scenarios, where each element is a named vector of parameter values with an added element scenario giving the scenario index.

See also

grouped for creating grouped parameter objects.

Examples

# 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"      "x"      "1" 
#> 
#> [[2]]
#>        a        b scenario 
#>      "2"      "x"      "2" 
#> 
#> [[3]]
#>        a        b scenario 
#>      "1"      "y"      "3" 
#> 
#> [[4]]
#>        a        b scenario 
#>      "2"      "y"      "4" 
#> 
head(s2)
#> [[1]]
#>        a        x        y scenario 
#>    "low"      "1"     "10"      "1" 
#> 
#> [[2]]
#>        a        x        y scenario 
#>    "low"      "1"     "10"      "1" 
#> 
#> [[3]]
#>        a        x        y scenario 
#>    "low"      "1"     "10"      "1" 
#> 
#> [[4]]
#>        a        x        y scenario 
#>   "high"      "1"     "10"      "2" 
#> 
#> [[5]]
#>        a        x        y scenario 
#>   "high"      "1"     "10"      "2" 
#> 
#> [[6]]
#>        a        x        y scenario 
#>   "high"      "1"     "10"      "2" 
#>