Learn R Programming

tongfen (version 0.3.6)

aggregate_data_with_meta: Aggregate variables in grouped data

Description

lifecycle::badge("maturing")

Aggregate census data up, assumes data is grouped for aggregation Uses data from meta to determine how to aggregate up

Usage

aggregate_data_with_meta(data, meta, geo = FALSE, na.rm = TRUE, quiet = FALSE)

Value

data frame with variables aggregated to new common geography

Arguments

data

census data as obtained from get_census call, grouped by TongfenID

meta

list with variables and aggregation information as obtained from meta_for_vectors

geo

logical, should also aggregate geographic data

na.rm

logical, should NA values be ignored or carried through.

quiet

logical, don't emit messages if set to `TRUE`

Examples

Run this code
# Aggregate population from DA level to grouped by CT_UID
if (FALSE) {
geo <- cancensus::get_census("CA06",regions=list(CSD="5915022"),level='DA')
meta <- meta_for_additive_variables("CA06","Population")
result <- aggregate_data_with_meta(geo %>% group_by(CT_UID),meta)
}

Run the code above in your browser using DataLab