Update joins.qmd (#1161)

This commit is contained in:
Jonathan Kitt 2022-11-29 14:46:36 +01:00 committed by GitHub
parent e2a4e1a236
commit f0b19065c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -724,7 +724,7 @@ x |> left_join(y, by = "key", keep = TRUE)
```{r}
#| label: fig-inner-both
#| fig-cap: >
#| An left join showing both `x` and `y` keys in the output.
#| A left join showing both `x` and `y` keys in the output.
#| fig-alt: >
#| A join diagram showing an inner join betwen x and y. The result
#| now includes four columns: key.x, val_x, key.y, and val_y. The
@ -736,7 +736,7 @@ x |> left_join(y, by = "key", keep = TRUE)
knitr::include_graphics("diagrams/join/inner-both.png", dpi = 270)
```
When we move away from equi-joins we'll always show the keys, because the key values will often different.
When we move away from equi-joins we'll always show the keys, because the key values will often be different.
For example, instead of matching only when the `x$key` and `y$key` are equal, we could match whenever the `x$key` is greater than or equal to the `y$key`, leading to @fig-join-gte.
dplyr's join functions understand this distinction equi and non-equi joins so will always show both keys when you perform a non-equi join.