Update for new cross_join() function

This commit is contained in:
Hadley Wickham 2022-12-18 10:18:49 -06:00
parent 35f9c847b7
commit ca75b0c02a
1 changed files with 2 additions and 1 deletions

View File

@ -783,10 +783,11 @@ knitr::include_graphics("diagrams/join/cross.png", dpi = 270)
Cross joins are useful when generating permutations.
For example, the code below generates every possible pair of names.
Since we're joining `df` to itself, this is sometimes called a **self-join**.
Cross joins use a different join function because there's no distinction between inner/left/right/full when you're matching every row.
```{r}
df <- tibble(name = c("John", "Simon", "Tracy", "Max"))
df |> left_join(df, join_by())
df |> cross_join(df)
```
### Inequality joins