Computes the crude birth rate (births per 1,000 population) per province and year, joining get_ine_births() and get_ine_population() output.

crude_birth_rate(births_df, pop_df)

Arguments

births_df

Births tibble as returned by get_ine_births()$data (columns nuts3_code, province_name, year, total).

pop_df

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

Value

A tibble with nuts3_code, province_name, year, cbr.

Details

This is a crude birth rate (total births / total population), not a total fertility rate (TFR). get_ine_births() itself has no age-of-mother breakdown, so crude_birth_rate() cannot compute a TFR on its own — for a true TFR, use get_ine_births_by_age() with age_specific_fertility_rate()/total_fertility_rate() instead. Do not substitute crude_birth_rate() for TFR in fertility analysis.

Examples

births <- tibble::tibble(
  nuts3_code = "ES111", province_name = "A Coruna", year = 2023, total = 100
)
pop <- tibble::tibble(
  nuts3_code = "ES111", year = 2023, age = c(0, 1), total = c(5000, 5000)
)
crude_birth_rate(births, pop)
#> # A tibble: 1 × 4
#>   nuts3_code province_name  year   cbr
#>   <chr>      <chr>         <dbl> <dbl>
#> 1 ES111      A Coruna       2023    10