Collapse upper ages into a single age group. Counts are summed while rates are recomputed where possible.
Collapse upper ages into a single age group. Counts are summed while rates are recomputed where possible.
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.
Returns
A vital object with the same variables as .data, but with the upper ages collapsed into a single 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).
Examples
aus_mortality |> dplyr::filter(State =="Victoria", Sex =="female")|> collapse_ages(max_age =85)