| rel_aggregate {duckdb} | R Documentation |
Lazily aggregate a DuckDB relation object
rel_aggregate(rel, groups, aggregates)
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 |
the now aggregated duckdb_relation object
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)