Computes the birth-to-death ratio (live births per death) per geography and year. Unlike age_dependency_ratio()/aging_index()/ sex_ratio(), this needs no age breakdown, so it operates directly on get_ine_demog()'s totals (System A) rather than get_ine_population() (System B) — fetch both births_total and deaths_total in one call and pass the result straight through.

birth_death_ratio(df)

Arguments

df

Output of get_ine_demog(indicator = c("births_total", "deaths_total")) (columns GEOID, NAME, year, births_total, deaths_total).

Value

A tibble with GEOID, NAME, year, birth_death_ratio. A value of 2 means 2 live births per death; 0.5 means 1 birth per 2 deaths.

Examples

df <- tibble::tibble(
  GEOID = c("15", "28"), NAME = c("A Coruna", "Madrid"), year = 2023,
  births_total = c(3000, 30000), deaths_total = c(6000, 25000)
)
birth_death_ratio(df)
#> # A tibble: 2 × 4
#>   GEOID NAME      year birth_death_ratio
#>   <chr> <chr>    <dbl>             <dbl>
#> 1 15    A Coruna  2023               0.5
#> 2 28    Madrid    2023               1.2