vital | R Documentation |
A vital object is a type of tsibble that contains vital statistics such as births, deaths, and population counts, and mortality and fertility rates. It is a tsibble with a special class that allows for special methods to be used. The object has an attribute that stores variables names needed for some functions, including age, sex, births, deaths and population.
vital(
...,
key = NULL,
index,
.age = NULL,
.sex = NULL,
.deaths = NULL,
.births = NULL,
.population = NULL,
regular = TRUE,
.drop = TRUE
)
... |
A set of name-value pairs |
key |
Variable(s) that uniquely determine time indices. NULL for empty key,
and |
index |
A variable to specify the time index variable. |
.age |
Character string with name of age variable |
.sex |
Character string with name of sex variable |
.deaths |
Character string with name of deaths variable |
.births |
Character string with name of births variable |
.population |
Character string with name of population variable |
regular |
Regular time interval ( |
.drop |
If |
A tsibble with class vital
.
Rob J Hyndman
tsibble::tsibble()
# create a vital with only age as a key
vital(
year = rep(2010:2015, 100),
age = rep(0:99, each = 6),
mx = runif(600, 0, 1),
index = year,
key = age,
.age = "age"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.