CompleteDFLEtable: Complete a dataframe with useful variables for the...

View source: R/CompleteDFLEtable.R

CompleteDFLEtableR Documentation

Complete a dataframe with useful variables for the calculation of disability-free life expectancies (DFLE)

Description

From an input dataset containing some information on age, mortality rates and prevalences of disability (at least 'age', 'qx' or 'mx', and 'pix' must be within the input dataset), the function completes it with values of life expectancies and disability-free life expectancies. If some indispensable variables are missing (eg 'age'), the output is the same as the input dataset. If the input dataset contains mortality rates ('qx') but no prevalence of disabilities ('pix'), only total life-expectancy is calculed.

Usage

CompleteDFLEtable(tab, categories = c(""))

Arguments

tab

a dataframe containing some of the variables

categories

a vector of names of variables of the 'tab' dataframe, representing categories (optional)

Details

Full headings for the names of variables in the output dataset can be found in the 'description_sullivan' dataframe (in the package).

If variables 'sex' and/or 'year' and/or 'categ' (an undefinite category variable that can be defined by the user) are in the input dataset, calculations are performed for each separate values of 'sex', 'year' and/or 'categ'. If 'categories' is provided (a vector of variable names in 'tab'), a 'categ' variable is created in a first step from all the variables in 'categories'.

Calculations follow example 1 in the sullivan manual (June 2007 version). See https://reves.site.ined.fr/en/resources/computation_online/sullivan/ for more explanations.

Value

a dataframe with all variables that can be calculated from the input dataframe

Examples

CompleteDFLEtable( sullivan[,c("year","age","mx","qx","pix")] )
CompleteDFLEtable( FRInseeMortalityForecast2016[FRInseeMortalityForecast2016$year %in% c(2013,2015,2020,2030),] )

patrickaubert/healthexpectancies documentation built on Feb. 5, 2024, 10 a.m.