rel_aggregate: Lazily aggregate a DuckDB relation object

rel_aggregateR Documentation

Lazily aggregate a DuckDB relation object

Description

Lazily aggregate a DuckDB relation object

Usage

rel_aggregate(rel, groups, aggregates)

Arguments

rel

the DuckDB relation object

groups

a list of DuckDB expressions to group by

aggregates

a (optionally named) list of DuckDB expressions with aggregates to compute

Value

the now aggregated duckdb_relation object

Examples

con <- DBI::dbConnect(duckdb())
rel <- rel_from_df(con, mtcars)
aggrs <- list(avg_hp = expr_function("avg", list(expr_reference("hp"))))
rel2 <- rel_aggregate(rel, list(expr_reference("cyl")), aggrs)

duckdb documentation built on Sept. 20, 2022, 9:07 a.m.