Extracts life expectancy at birth (e0) and at age 65 (e65) per
province and year from a build_life_tables() period life table.
Feeds map_life_expectancy(), which bridges this summary with
get_ine_geo()'s province geometries.
life_expectancy_summary(lt_df, sex = c("female", "male", "both"))One of build_life_tables()'s fltper, mltper, or
bltper tibbles (columns nuts3_code, province_name, year,
age, ex).
Character label to attach to the output ("female",
"male", or "both") — purely descriptive, matching which life
table (fltper/mltper/bltper) was passed in.
A tibble with nuts3_code, province_name, year, e0,
e65, sex.
lt <- tibble::tibble(
nuts3_code = "ES111", province_name = "A Coruna", year = 2023,
age = c(0, 65), ex = c(86.97, 20.5)
)
life_expectancy_summary(lt, sex = "female")
#> # A tibble: 1 × 6
#> nuts3_code province_name year e0 e65 sex
#> <chr> <chr> <dbl> <dbl> <dbl> <chr>
#> 1 ES111 A Coruna 2023 87.0 20.5 female