| lifeExpectancy {demlife} | R Documentation |
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.
lifeExpectancy(object, age = 0) ## S4 method for signature 'LifeTable' lifeExpectancy(object, age = 0)
object |
An object of class |
age |
The age from which life expectancy is calculated. Defaults to 0. |
An object of class Values, or, if,
there is only one dimension, a numeric vector.
Values for life expectancy can also be extracted from a
LifeTable object using lifeTableFun,
though in this case all ages are shown.
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)