@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user