Mention ties

Fixes #1320
This commit is contained in:
Hadley Wickham 2023-03-08 17:41:23 -06:00
parent cca1cd4e07
commit 2b2a35bb93
1 changed files with 6 additions and 1 deletions

View File

@ -635,7 +635,12 @@ flights |>
relocate(dest)
```
This is similar to computing the max delay with `summarize()`, but you get the whole corresponding row instead of the single summary statistic.
Note that there are 105 destinations but we get 108 rows here.
What's up?
`slice_min()` and `slice_max()` keep tied values so `n = 1` means give me all rows with the highest value.
If you want exactly one row per group you can set `keep_ties = FALSE`.
This is similar to computing the max delay with `summarize()`, but you get the whole corresponding row (or rows if there's a tie) instead of the single summary statistic.
### Grouping by multiple variables