bSims (version 0.2-1)

expand_list: 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().

See Also

expand.grid

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab