R: Lazily aggregate a DuckDB relation object

rel_aggregate {duckdb} | R 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)

[Package duckdb version 0.4.0 Index]