Skip to contents

Returns remaining life expectancy at a given age (0 by default).

Usage

life_expectancy(.data, from_age = 0, mortality)

Arguments

.data

A vital object including an age variable and a variable containing mortality rates.

from_age

Age at which life expectancy to be calculated. Either a scalar or a vector of ages.

mortality

Variable in .data containing Mortality rates (mx). If omitted, the variable with name mx, Mortality or Rate will be used (not case sensitive).

Value

A vital object with life expectancy in column ex.

References

Chiang CL. (1984) The life table and its applications. Robert E Krieger Publishing Company: Malabar.

Keyfitz, N, and Caswell, H. (2005) Applied Mathematical Demography, Springer-Verlag: New York.

Preston, S.H., Heuveline, P., and Guillot, M. (2001) Demography: measuring and modeling population processes. Blackwell

See also

Author

Rob J Hyndman

Examples

# Compute Victorian life expectancy for females over time
aus_mortality |>
  dplyr::filter(Code == "VIC", Sex == "female") |>
  life_expectancy()
#> # A vital: 120 x 9 [1Y]
#> # Key:     Age x (Sex, State, Code) [1 x 1]
#>     Year   Age Sex    State    Code     ex    rx    nx    ax
#>    <int> <int> <chr>  <chr>    <chr> <dbl> <dbl> <dbl> <dbl>
#>  1  1901     0 female Victoria VIC    55.8 0.937     1 0.334
#>  2  1902     0 female Victoria VIC    55.6 0.934     1 0.35 
#>  3  1903     0 female Victoria VIC    56.2 0.936     1 0.342
#>  4  1904     0 female Victoria VIC    58.9 0.949     1 0.256
#>  5  1905     0 female Victoria VIC    59.2 0.948     1 0.264
#>  6  1906     0 female Victoria VIC    58.0 0.941     1 0.309
#>  7  1907     0 female Victoria VIC    59.8 0.951     1 0.246
#>  8  1908     0 female Victoria VIC    58.9 0.945     1 0.280
#>  9  1909     0 female Victoria VIC    61.2 0.953     1 0.234
#> 10  1910     0 female Victoria VIC    60.8 0.950     1 0.249
#> # ℹ 110 more rows