Update joins.qmd (#1161)
This commit is contained in:
@@ -724,7 +724,7 @@ x |> left_join(y, by = "key", keep = TRUE)
|
|||||||
```{r}
|
```{r}
|
||||||
#| label: fig-inner-both
|
#| label: fig-inner-both
|
||||||
#| fig-cap: >
|
#| 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: >
|
#| fig-alt: >
|
||||||
#| A join diagram showing an inner join betwen x and y. The result
|
#| 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
|
#| 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)
|
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.
|
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.
|
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.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user