View source: R/lifetable_function.R
lifetable | R Documentation |
Gives user more control over their lifetable compared to the life_expectancy() function. Allows the user to add in the central death rate and proportion surviving to age x. Allows the user to omit accessory columns which are used to calculate life expectancy.
lifetable(
data,
age,
pop,
deaths,
includeAllSteps = TRUE,
includeCDR = TRUE,
includePS = TRUE,
...
)
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 |
includeAllSteps |
If false, will only include the proportion surviving to age x and life expectancy for age x |
includeCDR |
If true, will include the central death rate for each age group |
includePS |
If true, will include the proportion surviving for each age group |
... |
Other optional grouping variables (can be race, gender, etc.) |
Lifetable
# Running lifetable() and choosing not to include CentralDeathRate and
# ProportionToSurvive (optional columns) in the output dataset
lifetable(mortality2, "age_group", "population", "deaths", FALSE, TRUE, TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.