cross_list {crossmap}R 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)

[Package crossmap version 0.4.0 Index]