collapse_ages {vital} | R Documentation |
Collapse upper ages into a single age group. Counts are summed while rates are recomputed where possible.
Description
Collapse upper ages into a single age group. Counts are summed while rates are recomputed where possible.
Usage
collapse_ages(.data, max_age = 100)
Arguments
.data |
A vital object including an age variable |
max_age |
Maximum age to include in the collapsed age group. |
Details
If the object includes deaths, population and mortality rates, then deaths and population are summed and mortality rates are recomputed as deaths/population. But if the object contains mortality rates but not deaths and population, then the last rate remains unchanged (and a warning is generated).
Value
A vital object with the same variables as .data
, but with the upper
ages collapsed into a single age group.
Author(s)
Rob J Hyndman
Examples
aus_mortality |>
dplyr::filter(State == "Victoria", Sex == "female") |>
collapse_ages(max_age = 85)
[Package vital version 1.1.0 Index]