cross_list: List all combinations of values

View source: R/cross_list.R

cross_listR Documentation

List all combinations of values

Description

List all combinations of values

Usage

cross_list(...)

cross_tbl(...)

Arguments

...

Inputs or a list of inputs. NULL inputs are silently ignored.

Value

A list for cross_list() or tibble for cross_tbl(). Names will match the names of the inputs. Unnamed inputs will be left unnamed for cross_list() and automatically named for cross_tbl().

See Also

cross_join() to find combinations of data frame rows.

purrr::cross() for an implementation that results in a differently formatted list.

expand.grid() for an implementation that results in a data.frame.

Examples

fruits   <- c("apple", "banana", "cantaloupe")
desserts <- c("cupcake", "muffin", "streudel")

cross_list(list(fruits, desserts))
cross_list(fruits, desserts)
cross_tbl(fruits, desserts)

cross_list(list(fruit = fruits, dessert = desserts))
cross_list(fruit = fruits, dessert = desserts)
cross_tbl(fruit = fruits, dessert = desserts)

crossmap documentation built on Jan. 13, 2023, 1:13 a.m.