collapse_age_dist: Callapse age groups into broader ones

Description Usage Arguments Value Examples

View source: R/collapse_age_dist.R

Description

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

Usage

1
2
3

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

1
2
3
4
5
6
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))

excessmort documentation built on Oct. 11, 2021, 9:06 a.m.