IBMPopSim (version 0.3.0)

age_pyramid: Age pyramid from a population data frame at a given time.

Description

Reduce a population data frame containing all individuals (with some characteristics) to an age-groups data frame (preserving characteristics). The function computes the number of individuals at time in each age group [ages[i],ages[i+1][, for i in {1,...,N-1}.

Usage

age_pyramid(population, time = 0, ages = c(0:110, Inf))

Arguments

population

Population data frame: characteristics in columns and individuals in rows. At least two columns birth (dates of birth) and death (dates of death) are required.

time

The age pyramid is computed at instant time. Must be a numeric greater than or equal to 0.

ages

(Optional) A numeric vector of distinct positive values composing age groups. Must be in increasing order.

Value

Age pyramid of a population at instant time. A data frame with columns age and value. Optional characteristics are preserved.

Details

See also age_pyramids.

Examples

Run this code
# NOT RUN {
age_pyramid(EW_pop_14$sample, time = 0)

age_pyramid(EW_popIMD_14$sample, time = 0, ages = seq(0, 120, by=2))

# }

Run the code above in your browser using DataLab