
Load population and death data, disaggregated by year, state, sex and age.
Source:R/get_death_population.R
get_death_population.Rd
get_death_population
function that allows the user to get a
demographic dataset of the population and deaths based on the given
parameters.
Usage
get_death_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
Character vector specifying the state(s) that the function will return.
- v_year
Numeric vector that specifies the year(s) to return. Must have numbers between 1970 and 2050. Default is 2021.
- v_sex
Character vector that selects sex. Options: Female, Male and Total.
- v_age
Numeric vector that specifies the age(s) to return.
- age_groups
Specifies whether to aggregate the output by age groups.
Examples
get_death_population(v_state = c("Aguascalientes", "Campeche"),
v_year = c(2021, 2046),
v_sex = c("Female", "Total"),
age_groups = TRUE)
#> # A tibble: 64 x 8
#> year state CVE_GEO sex age_group population deaths death_rate
#> <int> <fct> <int> <chr> <fct> <int> <int> <dbl>
#> 1 2021 Aguascalientes 1 Female [0,5] 73217 124 0.00169
#> 2 2021 Aguascalientes 1 Female (5,15] 129266 27 0.000209
#> 3 2021 Aguascalientes 1 Female (15,25] 129438 61 0.000471
#> 4 2021 Aguascalientes 1 Female (25,45] 216476 225 0.00104
#> 5 2021 Aguascalientes 1 Female (45,55] 82038 299 0.00364
#> 6 2021 Aguascalientes 1 Female (55,65] 55209 508 0.00920
#> 7 2021 Aguascalientes 1 Female (65,70] 17276 319 0.0185
#> 8 2021 Aguascalientes 1 Female (70,Inf] 29851 1733 0.0581
#> 9 2021 Aguascalientes 1 Total [0,5] 149230 281 0.00188
#> 10 2021 Aguascalientes 1 Total (5,15] 264282 76 0.000288
#> # ... with 54 more rows
get_death_population(v_state = "National",
v_year = c(2021, 2046, 2050),
v_sex = "Total",
age_groups= FALSE)
#> # A tibble: 24 x 8
#> year state CVE_GEO age sex population deaths death_rate
#> <int> <fct> <int> <int> <chr> <int> <int> <dbl>
#> 1 2021 National 0 0 Total 2127321 26649 0.0125
#> 2 2021 National 0 5 Total 2193584 542 0.000247
#> 3 2021 National 0 15 Total 2228965 1203 0.000540
#> 4 2021 National 0 25 Total 2153706 3065 0.00142
#> 5 2021 National 0 45 Total 1630861 5620 0.00345
#> 6 2021 National 0 55 Total 1265172 9810 0.00775
#> 7 2021 National 0 65 Total 809988 14581 0.0180
#> 8 2021 National 0 70 Total 579843 15887 0.0274
#> 9 2046 National 0 0 Total 1743438 9000 0.00516
#> 10 2046 National 0 5 Total 1813726 131 0.0000722
#> # ... with 14 more rows