R: Create a list from all combinations of factors

list.expand {rlist} | R Documentation

## 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

    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")))

[Package rlist version 0.4.6.1 Index]