Learn R Programming

crossmap (version 0.3.0)

cross_list: List all combinations of values

Description

List all combinations of values

Usage

cross_list(...)

cross_tbl(...)

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

Arguments

...

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

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

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

Run the code above in your browser using DataLab