life_expectancy: Compute life expectancy from age-specific mortality rates

View source: R/life_expectancy.R

life_expectancyR Documentation

Compute life expectancy from age-specific mortality rates

Description

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.

Author(s)

Rob J Hyndman

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

life_table()

Examples

# Compute Norwegian life expectancy for females over time
norway_mortality |>
  dplyr::filter(Sex == "Female") |>
  life_expectancy()

vital documentation built on Aug. 21, 2025, 5:34 p.m.