View source: R/fun-decompose.R
decompose_by_age | R Documentation |
Decompose the difference in life expectancy (at the smallest available age) of two populations represented by their life tables in a given period of time.
decompose_by_age(L1, L2)
L1 |
Life table corresponding to the region/time period 1; |
L2 |
Life table corresponding to the region/time period 2; |
A numerical vector.
...
# Data
L <- data_gbd2021_lt
# Select Life Table 1 & 2
region1 = "Romania"
region2 = "Mexico"
sex = "female"
year = 2021
L1 <- L[L$region == region1 & L$sex == sex & L$period == year, ]
L2 <- L[L$region == region2 & L$sex == sex & L$period == year, ]
# Age decomposition
dec <- decompose_by_age(L1, L2)
dec
plot_decompose(dec)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.