get_population: Load population data disaggregated by year, state, sex and...

View source: R/get_population.R

get_populationR Documentation

Load population data disaggregated by year, state, sex and age.

Description

get_population is a function that allows the user to get a demographic dataset regarding population and population proportions based on the given parameters.

Usage

get_population(
  v_state = "National",
  v_year = "2021",
  v_sex = "Total",
  v_age = c("0", "5", "15", "25", "45", "55", "65", "70"),
  age_groups = TRUE
)

Arguments

v_state

State(s) of desired data.

v_year

Year(s) of desired data. Must have numbers between 1970 and 2050.

v_sex

Vector selecting sex. Options: Female, Male and Total.

v_age

Specifies the age bins to aggregate and return.

age_groups

Specifies whether to aggregate the output by age groups.

Value

A demographic dataset indicating the year, the state, the state code (CVE_GEO), the age (group, when age_groups = TRUE), the population and the proportion of each row, in relation to the selected year and sex.

Examples

get_population(v_state =  "Chiapas",
               v_year = 2015,
               v_sex = "Total",
               v_age = c(0, 15, 45, 75),
               age_groups = FALSE)

get_population(v_state = c("Aguascalientes", "Campeche"),
               v_year = c(2010, 2021),
               v_sex = "Male",
               v_age = c(0, 15, 45, 75),
               age_groups = TRUE)


PADeCI/demogmx documentation built on Jan. 27, 2024, 6:43 a.m.