Skip to contents

Downloads census population data from IBGE (via the censobr package), groups ages into brackets, and returns a data frame with one row per census tract. Supports census years 2000, 2010, and 2022.

Usage

br_prepare_population(code_muni, year = 2010)

Arguments

code_muni

Numeric or character vector. IBGE municipality codes.

year

Integer. Census year: 2000, 2010, or 2022. Default: 2010.

Value

A data frame with columns: code_muni, code_tract, and population bracket columns (pop_*). The exact brackets depend on the census year (see Details).

Details

Requires the censobr, dplyr, tidyr, and data.table packages.

Census 2000 and 2010 produce the following voting-age brackets: pop_18_20, pop_21_24, pop_25_29, pop_30_39, pop_40_49, pop_50_59, pop_60_69.

Census 2022 produces: pop_15_19, pop_20_24, pop_25_29, pop_30_39, pop_40_49, pop_50_59, pop_60_69.

All years also produce: pop_00_04, pop_05_09, pop_10_14, pop_15_17 (or pop_15_19 for 2022), pop_70mais.

Additionally, all years produce gender × age columns used for calibration: pop_hom_* and pop_mul_* (7 age brackets each, 14 columns total).

See also

Other Brazil helpers: br_prepare_electoral(), br_prepare_tracts()

Examples

if (FALSE) { # \dontrun{
# Census 2010 population for Sao Paulo
pop <- br_prepare_population(code_muni = "3550308", year = 2010)
head(pop)
} # }