View source: R/verbs_grouping.R
| summarise | R Documentation |
Summarise grouped data
summarise(.data, ..., .groups = NULL)
summarize(.data, ..., .groups = NULL)
.data |
A grouped |
... |
Named aggregation expressions using |
.groups |
How to handle groups in the result. One of |
Aggregation is hash-based by default. When the engine detects it is advantageous, it switches to a sort-based path that can spill to disk, keeping memory bounded regardless of group count.
All aggregation functions accept na.rm = TRUE to skip NA values.
Without na.rm, any NA in a group poisons the result (returns NA).
R-matching edge cases: sum(na.rm = TRUE) on all-NA returns 0,
mean(na.rm = TRUE) on all-NA returns NaN, min/max(na.rm = TRUE) on
all-NA returns Inf/-Inf with a warning.
This is a materializing operation.
A vectra_node with one row per group.
f <- tempfile(fileext = ".vtr")
write_vtr(mtcars, f)
tbl(f) |> group_by(cyl) |> summarise(avg_mpg = mean(mpg)) |> collect()
unlink(f)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.