aggregate: Aggregate values by group

View source: R/aggregate.R

aggregateR Documentation

Aggregate values by group

Description

Compute grouped summaries for one or more value columns. When data is a single file path, the file is scanned once and only the grouping and value fields are extracted, without materialising the other columns.

Usage

aggregate(data, by, value = NULL, fun, ..., na.rm = FALSE, sort = TRUE)

Arguments

data

A data frame, or a single path to a delimited text file for the fused one-pass file mode.

by

Character vector of grouping columns.

value

Optional character vector of value columns to summarize.

fun

Summary function applied to each value column. In file mode this is one or more of "sum", "mean", "var", "sd", "min", "max", "n" and defaults to "sum".

...

Additional arguments passed to fun; in file mode, reader options such as where, delim, n_threads.

na.rm

Whether to remove missing values before summarizing (defaults to TRUE in file mode).

sort

Whether to sort output rows by group.

Value

A basetable containing one row per group.


basetable documentation built on Sept. 18, 2026, 9:13 a.m.