View source: R/collapse_ages.R
collapse_ages | R Documentation |
Collapse upper ages into a single age group. Counts are summed while rates are recomputed where possible.
collapse_ages(.data, max_age = 100)
.data |
A vital object including an age variable |
max_age |
Maximum age to include in the collapsed age group. |
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).
A vital object with the same variables as .data
, but with the upper
ages collapsed into a single age group.
Rob J Hyndman
aus_mortality |>
dplyr::filter(State == "Victoria", Sex == "female") |>
collapse_ages(max_age = 85)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.