Bridges System B's mortality pipeline (build_life_tables() via life_expectancy_summary()) with System A's spatial layer (get_ine_geo()) to render a province-level choropleth of life expectancy at birth. A thin wrapper around map_indicator() (a continuous gradient, since life expectancy has no natural discrete bins) that handles the nuts3_code -> GEOID bridge via province_lookup. See plot_ine_map() for the analogous region-highlighting map built purely on get_ine_geo().

map_life_expectancy(
  le_df,
  year,
  sex = "both",
  moveCAN = TRUE,
  can_gap_km = 60,
  title = NULL
)

Arguments

le_df

Output of life_expectancy_summary() (columns nuts3_code, year, e0, sex).

year

Numeric, the year to plot.

sex

Character, one of "female", "male", "both", matching the sex value in le_df to plot.

moveCAN

Logical, shift the Canary Islands next to the mainland (default TRUE). See get_ine_geo().

can_gap_km

Numeric, gap in km for the shifted Canary Islands (default 60). See get_ine_geo().

title

Optional plot title.

Value

A ggplot object.

Examples

if (FALSE) { # \dontrun{
# Not run: get_ine_geo() requires live network access to fetch province
# boundaries.
lt <- build_life_tables(rates$mx_1x1)
le <- life_expectancy_summary(lt$fltper, sex = "female")
map_life_expectancy(le, year = max(le$year), sex = "female")
} # }