Post #2460366
2026-05-08 21:29 UTC
@DataAngler@vis.social mutate and filter also have the .by argument:
df |>
summarise(.by = c(species, island), n=n()) |>
mutate(.by = species, Pct = n/sum(n))
The only difference is the order
TIL that dplyr will warn about grouped operations and further operations that are ungrouped:
From your first example:
`summarise()` has regrouped the output.
ℹ Summaries were computed grouped by species and island.
ℹ Output is grouped by species.
ℹ Use `summarise(.groups = "drop_last")` to silence this message.
Replies (0)
No replies.