From 2316168cd451f5b76c4638495a70e1d313c0b4c8 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Tue, 24 Jan 2023 09:16:09 -0600 Subject: [PATCH] Numbers tweaks --- numbers.qmd | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/numbers.qmd b/numbers.qmd index 197dd2b..e1fff77 100644 --- a/numbers.qmd +++ b/numbers.qmd @@ -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) ```