Summarise grouped data
Details
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.