Fixes #1350
This commit is contained in:
Hadley Wickham 2023-03-09 08:04:22 -06:00
parent 3530ce04d4
commit a793af0aac
1 changed files with 1 additions and 1 deletions

View File

@ -213,7 +213,7 @@ flights |>
distinct(origin, dest, .keep_all = TRUE)
```
It's not a coincidence that all of these distinct flights are on January 1, `distinct()` will find the find the first occurrence of a unique row in the dataset and discard the rest.
It's not a coincidence that all of these distinct flights are on January 1: `distinct()` will find the first occurrence of a unique row in the dataset and discard the rest.
If you want to find the number of occurrences instead, you're better off swapping `distinct()` for `count()`, and with the `sort = TRUE` argument you can arrange them in descending order of number of occurrences.
You'll learn more about count in @sec-counts.