Learn R Programming

simstudy (version 0.9.0)

scenario_list: Create list of parameter scenarios

Description

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

Usage

scenario_list(..., each = 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.

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.

See Also

grouped for creating grouped parameter objects.

Examples

Run this code
# 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)
head(s2)

Run the code above in your browser using DataLab