Numbers tweaks
This commit is contained in:
@@ -104,9 +104,7 @@ There are a couple of variants of `n()` that you might find useful:
|
|||||||
```{r}
|
```{r}
|
||||||
flights |>
|
flights |>
|
||||||
group_by(dest) |>
|
group_by(dest) |>
|
||||||
summarize(
|
summarize(carriers = n_distinct(carrier)) |>
|
||||||
carriers = n_distinct(carrier)
|
|
||||||
) |>
|
|
||||||
arrange(desc(carriers))
|
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:
|
Weighted counts are a common problem so `count()` has a `wt` argument that does the same thing:
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
|
#| results: false
|
||||||
flights |> count(tailnum, wt = distance)
|
flights |> count(tailnum, wt = distance)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user