collapse_age_dist {excessmort}R Documentation

Callapse age groups into broader ones

Description

Collapse a count or demographic data frame into a broader age strata.

Usage

collapse_age_dist(demo, breaks)

collapse_counts_by_age(counts, breaks)

Arguments

demo

A data frame with population sizes for different groups that will be collapsed.

breaks

The new age breaks for the new, broader, age strata.

counts

A data frame with counts and population sizes for different groups that will be collapsed

Value

A age groups represented in 'demo' or 'counts' are grouped using the new age breaks defined by breaks but containing the populations and counts, if applicable, for age groups defined by 'breaks'.

Examples


library(lubridate)
data(cook_records)
## define smaller subset for example
cook_demographics_subset <- cook_demographics[year(cook_demographics$date)==2021, ]
demo <- collapse_age_dist(cook_demographics_subset, 
                          breaks = c(0, 20, 40, 60, 80, Inf))

[Package excessmort version 0.7.0 Index]