Learn R Programming

popstudy (version 1.0.2)

Lifetable: Life Table

Description

Estimates a lifetable from mortality rates and population data.

Usage

Lifetable(
  rates,
  pops,
  sex,
  max_age = NULL,
  first_year,
  threshold,
  jump,
  element = c("mx", "qx", "lx", "dx", "Lx", "Tx", "ex", "rx"),
  ...
)

Value

Lifetable function returns a list with both data frames, wide and long format, for specified element in argument element for desire years.

Arguments

rates

character. A character string that specifies mortality data path. The dataset is a .txt file like CR_mortality_rates_2010_2015 dataset.

pops

character. A character string that specifies population data path. The dataset is a .txt file like CR_populations_1950_2015 dataset.

sex

character. "female" or "male".

max_age

numeric. Desire omega age. If NULL, Lifetable function takes the dataset's maximum age.

first_year

numeric. First year to start estimation.

threshold

numeric. Maximum forecast year.

jump

character. Same purpose to jumpchoice argument in forecast function.

element

character. Wanted estimation element, one of "mx", "qx", "lx", "dx", "Lx", "Tx", "ex" or "rx".

...

additional arguments to be passed to read.demogdata, such as label.

Author

Cesar Gamboa-Sanabria

References

Lifetablepopstudy

Examples

Run this code

# \donttest{
if (FALSE) {
 write.table(CR_mortality_rates_2010_2015,
 file = "CR_mortality_rates_2010_2015.txt",
 sep = "\t", row.names = FALSE, quote = FALSE)

 write.table(CR_populations_1950_2015,
 file = "CR_populations_1950_2015.txt",
 sep = "\t", row.names = FALSE, quote = FALSE)

 Lifetable("CR_mortality_rates_2010_2015.txt", "CR_populations_1950_2015.txt",
 sex="female", first_year=2011, threshold=2150, jump="actual", max_age = 100,
 element="ex", label="CR")
}
# }

Run the code above in your browser using DataLab