closest() now in dev dplyr
This commit is contained in:
@@ -855,17 +855,10 @@ And for each employee we want to find the first party date that comes after (or
|
|||||||
We can express that with a rolling join:
|
We can express that with a rolling join:
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
#| eval: false
|
|
||||||
employees |>
|
employees |>
|
||||||
left_join(parties, join_by(closest(birthday >= party)))
|
left_join(parties, join_by(closest(birthday >= party)))
|
||||||
```
|
```
|
||||||
|
|
||||||
```{r}
|
|
||||||
#| echo: false
|
|
||||||
employees |>
|
|
||||||
left_join(parties, join_by(preceding(birthday, party)))
|
|
||||||
```
|
|
||||||
|
|
||||||
### Overlap joins
|
### Overlap joins
|
||||||
|
|
||||||
Overlap joins provide three helpers that use inequality joins to make it easier to work with intervals:
|
Overlap joins provide three helpers that use inequality joins to make it easier to work with intervals:
|
||||||
|
|||||||
Reference in New Issue
Block a user