Learn R Programming

duckdb (version 0.6.0)

rel_aggregate: Lazily aggregate a DuckDB relation object

Description

Lazily aggregate a DuckDB relation object

Usage

rel_aggregate(rel, groups, aggregates)

Value

the now aggregated duckdb_relation object

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

Examples

Run this code
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)

Run the code above in your browser using DataLab