From ca75b0c02adcde87d388313473be0ffd24ffe028 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Sun, 18 Dec 2022 10:18:49 -0600 Subject: [PATCH] Update for new cross_join() function --- joins.qmd | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/joins.qmd b/joins.qmd index b77fc51..c47f542 100644 --- a/joins.qmd +++ b/joins.qmd @@ -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