Computes the aging index (elderly per 100 children) 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.

aging_index(pop_df, young_max = 14L, old_min = 65L)

Arguments

pop_df

Population tibble as returned by get_ine_population()$data (columns nuts3_code, province_name, year, age, total).

young_max

Integer, the maximum age counted as "young" (default 14, i.e. ages 0-14).

old_min

Integer, the minimum age counted as "old" (default 65).

Value

A tibble with nuts3_code, province_name, year, aging_index.

Examples

pop <- tibble::tibble(
  nuts3_code = "ES111", province_name = "A Coruna", year = 2023,
  age = c(0, 20, 70), total = c(100, 300, 150)
)
aging_index(pop)
#> # A tibble: 1 × 4
#>   nuts3_code province_name  year aging_index
#>   <chr>      <chr>         <dbl>       <dbl>
#> 1 ES111      A Coruna       2023         150