cross_join | R Documentation |
Adds columns from a set of data frames, creating all combinations of their rows
cross_join(..., copy = FALSE)
... |
Data frames or a list of data frames – including
data frame extensions (e.g. tibbles) and lazy data
frames (e.g. from dbplyr or dtplyr).
|
copy |
If inputs are not from the same data source, and copy is
|
An object of the same type as the first input. The order of the rows and columns of the first input is preserved as much as possible. The output has the following properties:
Rows from each input will be duplicated.
Output columns include all columns from each input. If columns have the same name, suffixes are added to disambiguate.
Groups are taken from the first input.
cross_list()
to find combinations of elements of vectors
and lists.
fruits <- dplyr::tibble( fruit = c("apple", "banana", "cantaloupe"), color = c("red", "yellow", "orange") ) desserts <- dplyr::tibble( dessert = c("cupcake", "muffin", "streudel"), makes = c(8, 6, 1) ) cross_join(fruits, desserts) cross_join(list(fruits, desserts)) cross_join(rep(list(fruits), 3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.