Skip to content
Snippets Groups Projects
Commit 22aa7ca2 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Fix warnings in the picky package test (mainly documentation issues)

parent b54cb929
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,6 @@ mortalityTable.ageShift = setClass(
generateAgeShift = function(initial = 0, YOBs = c(1900, 2100), step = -1) {
lns = diff(YOBs)
shifts = unlist(mapply(rep, initial + step * 0:(length(lns)-1), lns, SIMPLIFY = TRUE))
data.frame(shifts = shifts, row.names = YOBs[1]:(tail(YOBs, 1)-1))
data.frame(shifts = shifts, row.names = YOBs[1]:(utils::tail(YOBs, 1)-1))
}
......@@ -28,7 +28,7 @@ pad0 = function(v, l, value=0) {
}
}
padLast = function(v, l) {
pad0(v, l, tail(v, n = 1))
pad0(v, l, utils::tail(v, n = 1))
}
#' @export
......@@ -69,10 +69,9 @@ deathProbabilitiesIndividual = function(tables, YOB, ageDifferences) {
rep(0, -difference),
qx);
} else {
qxtmp = tail(qx, -difference);
qxtmp = utils::tail(qx, -difference);
}
qxnew = padLast(qxtmp, qxlen)
str(qxnew);
qxnew
},
tables, YOB, ageDifferences);
......@@ -109,7 +108,7 @@ periodDeathProbabilitiesIndividual = function(tables, period, ageDifferences) {
rep(0, -difference),
qx);
} else {
qxtmp = tail(qx, -difference);
qxtmp = utils::tail(qx, -difference);
}
qxnew = padLast(qxtmp, qxlen)
qxnew
......@@ -138,6 +137,7 @@ setMethod("baseYear", "mortalityTable.jointLives",
#' @describeIn deathProbabilities Return the (cohort) death probabilities of the
#' life table given the birth year (if needed)
#' @param ageDifferences A vector of age differences of all joint lives.
setMethod("deathProbabilities", "mortalityTable.jointLives",
function(object, ..., ageDifferences = c(), YOB = 1975) {
qxMatrix = deathProbabilitiesIndividual(c(object@table), YOB = YOB, ageDifferences = ageDifferences);
......@@ -156,6 +156,7 @@ setMethod("getOmega", "mortalityTable.jointLives",
#' @describeIn periodDeathProbabilities Return the (period) death probabilities
#' of the joint lives mortality table for a given observation year
#' @param ageDifferences A vector of age differences of all joint lives.
setMethod("periodDeathProbabilities", "mortalityTable.jointLives",
function(object, ..., ageDifferences = c(), Period = 1975) {
qxMatrix = periodDeathProbabilitiesIndividual(c(object@table), period = Period, ageDifferences = ageDifferences);
......
......@@ -37,6 +37,7 @@ mortalityTable.zeroes = function(name = "Zero mortality table", ages = 0:99) {
#' Generate a (deterministic) mortality table with only one probability set to 1 (for the given age)
#'
#' @param transitionAge The age where the deterministic transition occurs
#' @param name The name of the table
#' @param ages The ages of the table
#'
......@@ -63,3 +64,4 @@ mortalityTable.onceAndFuture = function(transitionAge, name = "Deterministic mor
deathProbs = sapply(ages, function(x) { if (x >= transitionAge) 1 else 0})
)
}
......@@ -4,6 +4,7 @@
#' @param pattern Restrict the results only to life table sets that match the pattern (default: "*" to show all sets)
#' @param package The package that contains the desired dataset in its \code{extdata/}
#' directory. Defaults to the "MortalityTables" package.
#' @param prefix The file prefix, defaults to MortalityTables. Can be overridden to list other types of files, like "PensionTables"
#'
#' @export
mortalityTables.list = function(pattern = "*", package = "MortalityTables", prefix = "MortalityTables") {
......
......@@ -36,6 +36,8 @@ deathProbabilities(object, ..., YOB = 1975)
\item{...}{Other parameters (currently unused)}
\item{YOB}{The birth year for which the death probabilities should be calculated}
\item{ageDifferences}{A vector of age differences of all joint lives.}
}
\description{
Return the (cohort) death probabilities of the life table given the birth year (if needed)
......
......@@ -8,6 +8,8 @@ mortalityTable.once(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}
......
......@@ -13,6 +13,8 @@ mortalityTables.list(pattern = "*", package = "MortalityTables",
\item{package}{The package that contains the desired dataset in its \code{extdata/}
directory. Defaults to the "MortalityTables" package.}
\item{prefix}{The file prefix, defaults to MortalityTables. Can be overridden to list other types of files, like "PensionTables"}
}
\description{
List all available sets of life tables provided by the \link[MortalityTables]{MortalityTables-package} package
......
......@@ -39,6 +39,8 @@ periodDeathProbabilities(object, ..., Period = 1975)
\item{...}{Other parameters (currently unused)}
\item{Period}{The observation year for which the period death probabilities should be determined}
\item{ageDifferences}{A vector of age differences of all joint lives.}
}
\description{
Return the (period) death probabilities of the life table for a given
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment