Sends a server-side aggregation query to the CoV Open Data API and returns the result as a tibble. Because aggregation is performed by the API, this is suitable for summarising large datasets without downloading all records.
Results are cached for the duration of the R session.
aggregate_cov_data(
dataset_id,
select = "count(*) as count",
group_by = NULL,
where = NULL,
apikey = getOption("VancouverOpenDataApiKey"),
refresh = FALSE
)Dataset id from the Vancouver Open Data catalogue
Aggregation expression using ODSQL syntax. Default `"count(*) as count"`.
Grouping expression using ODSQL syntax. Default `NULL` (no grouping).
Filter expression using ODSQL syntax. Default `NULL` (no filter).
Vancouver Open Data API key, default `getOption("VancouverOpenDataApiKey")`
Bypass the session cache and re-download, default `FALSE`
A tibble with one row per group, with columns named according to the `select` expression.
[get_cov_data()] to download full or filtered records, [search_cov_datasets()] to find dataset IDs
if (FALSE) { # \dontrun{
# Count of each ticket status for fire hydrant infractions
aggregate_cov_data("parking-tickets-2017-2019",
group_by = "status",
where = "infractiontext LIKE 'FIRE'")
# Sum land and building values by tax year (server-side, no full download needed)
aggregate_cov_data("property-tax-report",
select = "sum(current_land_value) as Land,
sum(current_improvement_value) as Building",
group_by = "tax_assessment_year")
} # }