Computes youth, old-age, and total age dependency ratios per province and
year from age-disaggregated population data. Requires an age breakdown,
so it operates on get_ine_population()'s output, not
get_ine_demog()'s population_total indicator (which has no age
column and cannot be used here).
age_dependency_ratio(pop_df, young_max = 14L, old_min = 65L)A tibble with nuts3_code, province_name, year,
youth_dependency_ratio, old_age_dependency_ratio,
total_dependency_ratio (all per 100 working-age population).
pop <- tibble::tibble(
nuts3_code = "ES111", province_name = "A Coruna", year = 2023,
age = c(0, 20, 70), total = c(100, 300, 150)
)
age_dependency_ratio(pop)
#> # A tibble: 1 × 6
#> nuts3_code province_name year youth_dependency_ratio old_age_dependency_ratio
#> <chr> <chr> <dbl> <dbl> <dbl>
#> 1 ES111 A Coruna 2023 33.3 50
#> # ℹ 1 more variable: total_dependency_ratio <dbl>