grid: Functions to create grids and lists of model and simulation...

gridR Documentation

Functions to create grids and lists of model and simulation runs

Description

Grids of combinations of variables (or parameters) can be created from a list of scenarios contaning all possible values for each variables. Such a grid can be used when conditioning an operating model around the structural uncertainty of fixed parameters and submodel choices. And it can also be used to create a range of combinations of management procedure parameters for tuning and selection of MPs.

Usage

expandGrid(scenarios, ..., names = FALSE)

gridList(scenarios, ..., grid = missing)

Arguments

scenarios

Values and levels for each run variable, list.

...

Extra arguments, see Details.

names

Should the table output contain names (FALSE) or indices (TRUE, default).

grid

Index table with grid to be converted into input list.

Details

The list of scenarios used as input should contain one element per variable, be it either a vector or a list of alternative values. The list must be named, and elements of class list should themselves be named. Names are added to vector elements by calling as.character() on their content. See examples below for guidance.

Value

A data.frame or list.

Author(s)

Iago Mosqueira, EC JRC

See Also

FLComp

Examples

# Lists of scenarios can contains vectors ...
list(steepness=c(0.6, 0.7, 0.8), M=c(0.2, 0.3, 0.4))
# lists ...
list(M=list(0.2, 0.4, lo=seq(0.2, 0.4, length=10)))
# or both
scenarios  <- list(steepness=c(0.7, 0.8), M=list(0.2, 0.4, lo=seq(0.2, 0.4, length=10)))
# Create full grid as index table
expandGrid(scenarios)
# Drop certain combinations
expandGrid(scenarios, M == 0.2 & steepness == 0.7, M == "lo" & steepness == 0.8)
# Output as names
expandGrid(scenarios, M == 0.2 & steepness == 0.7, names=TRUE)
# Create list of variable combinations
runs <- gridList(scenarios)
runs[[1]]
length(runs)
# Create list but dropping certain combinations
runs <- gridList(scenarios, M == 0.2 & steepness == 0.7)
runs[[1]]
length(runs)

flr/mse documentation built on Oct. 1, 2024, 8:30 p.m.