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