expand_age_pop transforms population data aggregated in age groups into estimates for single-year ages. It utilizes interpolation methods to distribute the grouped data across individual ages, ensuring consistency with the original totals.

expand_age_pop(x, method = "linear")

Arguments

x

A numeric vector representing the population counts for each age group. The vector should have 19 elements corresponding to the following age groups: 0, 1–4, 5–9, ..., 85+.

method

A character string specifying the interpolation method to use. Options include:

  • "linear": Linear interpolation.

  • "constant": Constant interpolation.

  • "periodic": Periodic spline interpolation.

  • "natural": Natural spline interpolation.

The default is "linear".

Value

A data frame with two columns:

x

Integer ages from 0 to 92.

y

Estimated population counts for each single-year age.

Examples

# Example population data for 19 age groups: 0, 1–4, 5–9, ..., 85+
ages <- c(
  5053, 17743, 25541, 32509, 30530, 34806, 36846, 38691, 40056,
  39252, 37349, 30507, 26363, 21684, 15362, 11725, 7461, 3260, 915
)
eages <- expand_age_pop(ages)
head(eages)
#>   x    y
#> 1 0 5053
#> 2 1 4649
#> 3 2 4446
#> 4 3 4240
#> 5 4 4408
#> 6 5 4704