person_years | R Documentation |
Adds a new column called PersonYears to the dataset that was input. PersonYears represents the number of years lived at age x based on the number surviving to age x.
person_years(data, age, pop, deaths)
data |
The mortality dataset, includes an age grouping variable, |
age |
The age grouping variable, must be categorical |
pop |
Population of each age group, must be numeric |
deaths |
The midyear number of deaths at each age group, must be numeric |
Dataset that was input with the added columns: ConditionalProbDeath, ConditionalProbLife, NumberToSurvive, PropToSurvive, PersonYears.
# This function will add the ConditionalProbDeath, ConditionalProbLife,
# NumberToSurvive, PropToSurvive, and PersonYears columns to the dataset
person_years(mortality2, "age_group", "population", "deaths")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.