scenario_grid: Build a replicated scenario grid

View source: R/design_structure.R

scenario_gridR Documentation

Build a replicated scenario grid

Description

Crosses every combination of the supplied scenario values and repeats each combination replications times, giving the grid a simulation study is run over.

Usage

scenario_grid(..., replications = 1L, id = "scenario_id")

Arguments

...

Named vectors of scenario values, at least one, crossed with expand.grid(). The names become the value columns.

replications

Replications per scenario combination. A single positive whole number, defaulting to 1.

id

Name of the scenario identifier, numbering the distinct combinations. A single non-empty string, defaulting to "scenario_id".

Value

A plain base data.frame, not a simulab_sim, with one row per scenario replication and columns: the scenario identifier named by id, the integer replication counting from 1 within each scenario, and one column per named argument.

Examples

scenario_grid(mean_b = c(0, 0.5), n_b = c(20, 40), replications = 2)

simulab documentation built on Oct. 15, 2026, 5:08 p.m.