Numbers tweaks

This commit is contained in:
Hadley Wickham
2023-01-24 09:16:09 -06:00
parent fb80197bf7
commit 2316168cd4

View File

@@ -104,9 +104,7 @@ There are a couple of variants of `n()` that you might find useful:
```{r}
flights |>
group_by(dest) |>
summarize(
carriers = n_distinct(carrier)
) |>
summarize(carriers = n_distinct(carrier)) |>
arrange(desc(carriers))
```
@@ -122,6 +120,7 @@ There are a couple of variants of `n()` that you might find useful:
Weighted counts are a common problem so `count()` has a `wt` argument that does the same thing:
```{r}
#| results: false
flights |> count(tailnum, wt = distance)
```