total_years_lived {actLifer} | R Documentation |
Total Years Lived From Age x
Description
Adds a new column called TotalYears to the dataset that was input. TotalYears is the number of years lived from age zero to age x.
Usage
total_years_lived(data, age, pop, deaths)
Arguments
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 |
Value
Dataset that was input with the added columns: ConditionalProbDeath, ConditionalProbLife, NumberToSurvive, PersonYears, and TotalYears.
Examples
# This function will add the ConditionalProbDeath, ConditionalProbLife,
# NumberToSurvive, PropToSurvive, PersonYearsm and TotalYears columns to the
# dataset
total_years_lived(mortality2, "age_group", "population", "deaths")
[Package actLifer version 1.0.0 Index]