Learn R Programming

rlist (version 0.4.6.1)

list.expand: Create a list from all combinations of factors

Description

Create a list from all combinations of the supplied vectors or lists, extending the functionality of expand.grid from data frame to list.

Usage

list.expand(...)

Arguments

...

vectors or lists

Value

A list of all combinations of the supplied vectors or lists.

Examples

Run this code
# NOT RUN {
list.expand(x=1:10, y=c("a","b","c"))
list.expand(x=list(c(1,2), c(2,3)), y = c("a","b","c"))
list.expand(
  a=list(list(x=1,y="a"), list(x=2, y="b")),
  b=list(c("x","y"), c("y","z","w")))
# }

Run the code above in your browser using DataLab