From 22aa7ca2b3f154c18696e6cc7617bd37ebdbb339 Mon Sep 17 00:00:00 2001
From: Reinhold Kainhofer <reinhold@kainhofer.com>
Date: Wed, 30 Aug 2017 00:13:08 +0000
Subject: [PATCH] Fix warnings in the picky package test (mainly documentation
 issues)

---
 R/mortalityTable.ageShift.R     | 2 +-
 R/mortalityTable.jointLives.R   | 9 +++++----
 R/mortalityTable.period.R       | 2 ++
 R/mortalityTables.list.R        | 1 +
 man/deathProbabilities.Rd       | 2 ++
 man/mortalityTable.once.Rd      | 2 ++
 man/mortalityTables.list.Rd     | 2 ++
 man/periodDeathProbabilities.Rd | 2 ++
 8 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/R/mortalityTable.ageShift.R b/R/mortalityTable.ageShift.R
index 8caa4df..0bd0750 100644
--- a/R/mortalityTable.ageShift.R
+++ b/R/mortalityTable.ageShift.R
@@ -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))
 }
 
diff --git a/R/mortalityTable.jointLives.R b/R/mortalityTable.jointLives.R
index bea87dd..013ffb6 100644
--- a/R/mortalityTable.jointLives.R
+++ b/R/mortalityTable.jointLives.R
@@ -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);
diff --git a/R/mortalityTable.period.R b/R/mortalityTable.period.R
index d569e51..3edbcd1 100644
--- a/R/mortalityTable.period.R
+++ b/R/mortalityTable.period.R
@@ -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})
     )
 }
+
diff --git a/R/mortalityTables.list.R b/R/mortalityTables.list.R
index 4728548..9687829 100644
--- a/R/mortalityTables.list.R
+++ b/R/mortalityTables.list.R
@@ -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") {
diff --git a/man/deathProbabilities.Rd b/man/deathProbabilities.Rd
index 8aa7f1e..9741acc 100644
--- a/man/deathProbabilities.Rd
+++ b/man/deathProbabilities.Rd
@@ -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)
diff --git a/man/mortalityTable.once.Rd b/man/mortalityTable.once.Rd
index a73d8c3..e5f0afd 100644
--- a/man/mortalityTable.once.Rd
+++ b/man/mortalityTable.once.Rd
@@ -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}
diff --git a/man/mortalityTables.list.Rd b/man/mortalityTables.list.Rd
index a57f52f..52393e3 100644
--- a/man/mortalityTables.list.Rd
+++ b/man/mortalityTables.list.Rd
@@ -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
diff --git a/man/periodDeathProbabilities.Rd b/man/periodDeathProbabilities.Rd
index 0edd28e..3530781 100644
--- a/man/periodDeathProbabilities.Rd
+++ b/man/periodDeathProbabilities.Rd
@@ -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
-- 
GitLab