expand_list {bSims}R Documentation

Create a list from all combinations of arguments

Description

Create a list from all combinations of the supplied vectors or lists.

Usage

expand_list(...)

Arguments

...

vectors or lists. All arguments must be named.

Value

A list containing one element for each combination of the supplied vectors and lists. The first factors vary fastest. The nested elements are labeled by the factors.

The function allows list elements to be vectors, functions, or NULL. If a vector element is supposed to be kept as a vector, use list().

Author(s)

Peter Solymos

See Also

expand.grid

Examples

b <- expand_list(
  movement = c(0, 1, 2),
  rint = list(c(0.5, 1, 1.5, Inf)), # in a list to keep as one
  xy_fun = list(NULL, function(z) z))
b[[1]]
str(b)

[Package bSims version 0.3-0 Index]