Computes the rate of natural increase (RNI = CBR - CDR, per 1,000 population) per province and year, combining already-computed crude_birth_rate() and crude_death_rate() output rather than re-deriving from raw births/deaths/population — consistent with how life_expectancy_summary() consumes build_life_tables()'s output rather than recomputing it.

rate_of_natural_increase(cbr_df, cdr_df)

Arguments

cbr_df

Output of crude_birth_rate() (columns nuts3_code, province_name, year, cbr).

cdr_df

Output of crude_death_rate() (columns nuts3_code, year, cdr).

Value

A tibble with nuts3_code, province_name, year, rni. A positive value means births outnumber deaths (population growing from natural change alone, ignoring migration); negative means the reverse.

Examples

cbr <- tibble::tibble(
  nuts3_code = "ES111", province_name = "A Coruna", year = 2023, cbr = 6.5
)
cdr <- tibble::tibble(nuts3_code = "ES111", year = 2023, cdr = 12.3)
rate_of_natural_increase(cbr, cdr)
#> # A tibble: 1 × 4
#>   nuts3_code province_name  year   rni
#>   <chr>      <chr>         <dbl> <dbl>
#> 1 ES111      A Coruna       2023  -5.8