Joins are now polishing

This commit is contained in:
Hadley Wickham 2022-09-10 08:38:12 -05:00
parent 0a6af583b0
commit 594129b1b0
1 changed files with 3 additions and 2 deletions

View File

@ -4,7 +4,7 @@
#| results: "asis" #| results: "asis"
#| echo: false #| echo: false
source("_common.R") source("_common.R")
status("restructuring") status("polishing")
``` ```
## Introduction ## Introduction
@ -813,7 +813,8 @@ df |> left_join(df, join_by(id < id))
### Rolling joins ### Rolling joins
Rolling joins are a special type of inequality join where instead of getting *every* row that satisfies the inequality, you get just the closest row, as in @fig-join-closest. You can turn any inequality join into a rolling join by adding `closest()`. Rolling joins are a special type of inequality join where instead of getting *every* row that satisfies the inequality, you get just the closest row, as in @fig-join-closest.
You can turn any inequality join into a rolling join by adding `closest()`.
For example `join_by(closest(x <= y))` matches the smallest `y` that's greater than or equal to x, and `join_by(closest(x > y))` matches the biggest `y` that's less than `x`. For example `join_by(closest(x <= y))` matches the smallest `y` that's greater than or equal to x, and `join_by(closest(x > y))` matches the biggest `y` that's less than `x`.
```{r} ```{r}