diff --git a/NAMESPACE b/NAMESPACE index 81049604e66853084f7a4646258f06107367378a..0918ff00778e944387041208d50763519aeabfcf 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -13,6 +13,7 @@ export(mortalityTable.jointLives) export(mortalityTable.mixed) export(mortalityTable.observed) export(mortalityTable.once) +export(mortalityTable.onceAndFuture) export(mortalityTable.period) export(mortalityTable.trendProjection) export(mortalityTable.zeroes) diff --git a/R/mortalityTable.period.R b/R/mortalityTable.period.R index c1bf31aa18aac1060f1126f7d03333c72d5644cd..d569e51495d325f40b50623715f2d30a641292bc 100644 --- a/R/mortalityTable.period.R +++ b/R/mortalityTable.period.R @@ -49,3 +49,17 @@ mortalityTable.once = function(transitionAge, name = "Deterministic mortality ta ) } +#' Generate a (deterministic) mortality table with all probabilities starting at a given age set to 1 +#' +#' @param transitionAge The age where the deterministic transition occurs +#' @param name The name of the table +#' @param ages The ages of the table +#' +#' @export +mortalityTable.onceAndFuture = function(transitionAge, name = "Deterministic mortality table", ages = 0:99) { + mortalityTable.period( + name = name, + ages = ages, + deathProbs = sapply(ages, function(x) { if (x >= transitionAge) 1 else 0}) + ) +} diff --git a/man/mortalityTable.onceAndFuture.Rd b/man/mortalityTable.onceAndFuture.Rd new file mode 100644 index 0000000000000000000000000000000000000000..33c9cd1fd5cf97752909ed1935dda92c0774cb7e --- /dev/null +++ b/man/mortalityTable.onceAndFuture.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/mortalityTable.period.R +\name{mortalityTable.onceAndFuture} +\alias{mortalityTable.onceAndFuture} +\title{Generate a (deterministic) mortality table with all probabilities starting at a given age set to 1} +\usage{ +mortalityTable.onceAndFuture(transitionAge, + name = "Deterministic mortality table", ages = 0:99) +} +\arguments{ +\item{transitionAge}{The age where the deterministic transition occurs} + +\item{name}{The name of the table} + +\item{ages}{The ages of the table} +} +\description{ +Generate a (deterministic) mortality table with all probabilities starting at a given age set to 1 +}