lifeExpectancy {demlife}R Documentation

Calculate life expectancy.

Description

Obtain life expectancies from an object of class LifeTable. By default, lifeExpectancy returns life expectancy at age 0, but other ages can be used instead.

Usage

lifeExpectancy(object, age = 0)

## S4 method for signature 'LifeTable'
lifeExpectancy(object, age = 0)

Arguments

object

An object of class LifeTable.

age

The age from which life expectancy is calculated. Defaults to 0.

Value

An object of class Values, or, if, there is only one dimension, a numeric vector.

See Also

Values for life expectancy can also be extracted from a LifeTable object using lifeTableFun, though in this case all ages are shown.

Examples

al <- demdata::afghan.life
al <- dembase::Values(al)
mx <- dembase::subarray(al,
               subarray = (fun == "mx") & (time == "2001-2005"))
lt <- LifeTable(mx)
lt
lifeExpectancy(lt)
lifeExpectancy(lt, age = 65)

[Package demlife version 0.0.0.9007 Index]