Learn R Programming

bSims (version 0.3-2)

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

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

Arguments

...

vectors or lists. All arguments must be named.

Author

Peter Solymos

See Also

Examples

Run this code
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