Retrieves, cleans, and validates Spanish annual live-birth counts by
province, single year of age of the mother (15-49, plus the two open
intervals under15/50plus), and sex of the newborn, from INE's raw
Tempus3 JSON API. Unlike get_ine_births() (which has no age-of-mother
breakdown), this is the data source needed for age-specific fertility
rates - see age_specific_fertility_rate(), total_fertility_rate(),
mean_age_at_childbearing(), gross_reproduction_rate(), and
net_reproduction_rate().
get_ine_births_by_age(
table_id = 6508,
n_periods = 100,
use_cache = TRUE,
force = FALSE,
cache_dir = NULL
)INE Tempus3 table ID. Default 6508, confirmed for
"Nacimientos por lugar de residencia de la madre, sexo y edad de la
madre. Total nacional y provincias" (operation MNPN).
Number of most recent years to fetch. This table has
~6,000 series (province x age x newborn-sex), so fetches are slower
than get_ine_births()'s; caching (see use_cache) matters more here.
Logical (default TRUE). See get_ine_births().
Logical (default FALSE). See get_ine_births().
Directory for cached data. The default NULL caches
in a per-session directory under tempdir(): repeated calls in the same
session reuse the first download, but nothing persists afterwards. Pass a
directory, e.g. tools::R_user_dir("inedemogR", "cache"), for a cache
that persists across sessions. A cache stores the parsed result as
.rds; refresh it with force = TRUE. Results carry a provenance
attribute (request, retrieval time in UTC, API, package version).
list(data, qc): data is a tibble with columns ine_code,
nuts3_code, nuts2_code, province_name, year, age (integer,
NA for the under15 group), age_group (character: "under15",
"15".."49", "50plus"), female, male, total (births to
mothers of that age, by sex of the newborn); qc is the output of
validate_births_by_age().
if (FALSE) { # \dontrun{
# Not run: requires live network access to the INE API.
births_age <- get_ine_births_by_age(n_periods = 10)
births_age$data
} # }