From 32a2cb7b056ad030010d5495149d00231aaeafa4 Mon Sep 17 00:00:00 2001
From: Reinhold Kainhofer <reinhold@kainhofer.com>
Date: Fri, 27 Oct 2023 12:18:13 +0200
Subject: [PATCH] CRAN_V1.0.0: Changes/Fixes requested for CRAN submission

---
 .Rbuildignore                                 |  2 +
 DESCRIPTION                                   |  4 +-
 NEWS.md                                       |  4 +
 R/HelperFunctions.R                           |  8 ++
 R/addDataTableWorksheet.R                     | 73 -------------------
 R/contractGrid.R                              |  4 +
 R/exportInsuranceContractExample.R            |  5 +-
 R/exportInsuranceContract_xlsx.R              |  9 ++-
 R/showVmGlgExamples.R                         | 19 +++--
 README.md                                     |  8 +-
 cran-comments.md                              | 14 ++++
 inst/Beispiele/Example_Endowment.R            |  2 -
 man/age.exactRounded.Rd                       |  3 +
 man/age.yearDifference.Rd                     |  3 +
 man/contractGrid.Rd                           |  5 ++
 man/deathBenefit.annuityDecreasing.Rd         |  3 +
 man/deathBenefit.linearDecreasing.Rd          |  3 +
 man/exportInsuranceContract.xlsx.Rd           |  5 +-
 man/exportInsuranceContractExample.Rd         |  5 +-
 man/freqCharge.Rd                             |  3 +
 man/isRegularPremiumContract.Rd               |  3 +
 man/isSinglePremiumContract.Rd                |  3 +
 man/makeContractGridDimname.Rd                |  5 ++
 man/premiumRefundPeriod.default.Rd            |  3 +
 man/showVmGlgExamples.Rd                      |  7 +-
 man/testVmGlgExample.Rd                       | 14 ++--
 man/vmGlgExample.generateTest.Rd              |  3 +
 tests/testthat/test-extendContract.R          | 16 ++--
 ...ny-specific-implementations-as-package.Rmd |  6 +-
 vignettes/using-the-lifeinsurer-package.Rmd   | 13 ++--
 30 files changed, 133 insertions(+), 122 deletions(-)
 create mode 100644 NEWS.md
 delete mode 100644 R/addDataTableWorksheet.R
 create mode 100644 cran-comments.md

diff --git a/.Rbuildignore b/.Rbuildignore
index 75d241a..e728fde 100644
--- a/.Rbuildignore
+++ b/.Rbuildignore
@@ -8,3 +8,5 @@
 ^Examples
 .Rbuildignore$
 
+^revdep$
+^cran-comments\.md$
diff --git a/DESCRIPTION b/DESCRIPTION
index 7a8e148..917d935 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -6,14 +6,14 @@ Title: Framework for Traditional Life Insurance Contracts
 Description: R6 classes to model traditional life insurance
     contracts like annuities, whole life insurances or endowments. Such life
     insurance contracts provide a guaranteed interest and are not directly linked
-    to the performance of a particular investment vehicle. However, they typically
+    to the performance of a particular investment vehicle, but they typically
     provide (discretionary) profit participation. This package provides a framework
     to model such contracts in a very generic (cash-flow-based) way and includes
     modelling profit participation schemes, dynamic increases or more general
     contract layers, as well as contract changes (like sum increases or premium
     waivers). All relevant quantities like premium decomposition, reserves and 
     benefits over the whole contract period are calculated and potentially 
-    exported to excel. Mortality rates are given using the 'MortalityTables' package.
+    exported to 'Excel'. Mortality rates are given using the 'MortalityTables' package.
 Authors@R: c(person("Reinhold", "Kainhofer", role=c("aut", "cre"), email="reinhold@kainhofer.com"))
 Author: Reinhold Kainhofer [aut, cre]
 Maintainer: Reinhold Kainhofer <reinhold@kainhofer.com>
diff --git a/NEWS.md b/NEWS.md
new file mode 100644
index 0000000..5645ebd
--- /dev/null
+++ b/NEWS.md
@@ -0,0 +1,4 @@
+
+# Version 1.0.0: October 27, 2023
+  * Renamed package from LifeInsuranceContracts to LifeInsureR
+
diff --git a/R/HelperFunctions.R b/R/HelperFunctions.R
index 9184fba..d955c81 100644
--- a/R/HelperFunctions.R
+++ b/R/HelperFunctions.R
@@ -112,6 +112,7 @@ ProfitComponentsEnum = objectProperties::setMultipleEnum("ProfitComponents",
 #'
 #' @param params The parameters of the contract.
 #' @param values Unused by default (already calculated values of the contract)
+#' @returns TRUE or FALSE, indicating a single-premium contract or not
 #'
 #' @export
 isSinglePremiumContract = function(params, values) { params$ContractData$premiumPeriod <= 1 }
@@ -123,6 +124,7 @@ isSinglePremiumContract = function(params, values) { params$ContractData$premium
 #'
 #' @param params The parameters of the contract.
 #' @param values Unused by default (already calculated values of the contract)
+#' @returns TRUE or FALSE, indicating a contract with regular premiums
 #'
 #' @export
 isRegularPremiumContract = function(params, values) { params$ContractData$premiumPeriod > 1 }
@@ -141,6 +143,7 @@ isRegularPremiumContract = function(params, values) { params$ContractData$premiu
 #' @param params The full parameter set of the insurance contract (including
 #'               all inherited values from the tariff and the profit participation)
 #' @param values The values calculated from the insurance contract so far
+#' @returns vector of linearly decreasing benefits over the whole insurance coverage period
 #'
 #' @export
 deathBenefit.linearDecreasing = function(len, params, values) {
@@ -158,6 +161,7 @@ deathBenefit.linearDecreasing = function(len, params, values) {
 #' @param params The full parameter set of the insurance contract (including
 #'               all inherited values from the tariff and the profit participation)
 #' @param values The values calculated from the insurance contract so far
+#' @returns The length of the premium refund period (deferral period for deferred contracts, contract period otherwise)
 #'
 #' @export
 premiumRefundPeriod.default = function(params, values) {
@@ -187,6 +191,7 @@ premiumRefundPeriod.default = function(params, values) {
 #'
 #'
 #' @param interest The interest rate of the loan, which is underlying the insurance.
+#' @returns vector of decreasing death benefits
 #'
 #'
 #' @export
@@ -209,6 +214,7 @@ deathBenefit.annuityDecreasing = function(interest) {
 #'
 #' @param params The parameters of the contract.
 #' @param values Unused by default (already calculated values of the contract)
+#' @returns the resulting age
 #'
 #' @export
 age.exactRounded = function(params, values) {
@@ -222,6 +228,7 @@ age.exactRounded = function(params, values) {
 #'
 #' @param params The parameters of the contract.
 #' @param values Unused by default (already calculated values of the contract)
+#' @returns the resulting age
 #'
 #' @export
 age.yearDifference = function(params, values) {
@@ -255,6 +262,7 @@ age.yearDifference = function(params, values) {
 #' @param quarterly Surcharge for quarterly premium payments
 #' @param semiannually Surcharge for semi-annual premium payments
 #' @param yearly Surcharge for yearly premium payments (optiona, default is no surcharge)
+#' @returns a named list of surcharges for names 1 (yearly), 2 (semiannually), 4 (quarterly) and 12 (monthly) payments
 #'
 #' @export
 freqCharge = function(monthly = 0, quarterly = 0, semiannually = 0, yearly = 0) {
diff --git a/R/addDataTableWorksheet.R b/R/addDataTableWorksheet.R
deleted file mode 100644
index a8b0f3e..0000000
--- a/R/addDataTableWorksheet.R
+++ /dev/null
@@ -1,73 +0,0 @@
-#' Add a new worksheet to the excel workbook and export the given data table x to it nicely formatted.
-# @export
-# addDataTableWorksheet = function(wb, sheet, title = NULL, x = NULL, loopdim = 3, style = NULL, tableStyle = "TableStyleMedium17", comparisons = NULL, comparisonStyle = NULL, ...) {
-#     addWorksheet(wb, sheet);
-#     rw = 1;
-#     if (!missing(title)) {
-#         titleStyle = createStyle(
-#             fontSize = 26,
-#             fontColour = "#365F91", borderColour = "#4F81BD",
-#             borderStyle = "medium", border = "Bottom", textDecoration = "bold")
-#         writeData(wb, sheet, title, startCol = 1, startRow = rw)
-#         addStyle(wb, sheet, style = titleStyle, rows = rw, cols = 1);
-#         rw = rw + 2;
-#     }
-#     if (!missing(x)) {
-#         if (loopdim > length(dim(x)))
-#             loopdim = length(dim(x));
-#         if (loopdim < 0)
-#             loopdim = 1;
-#         # str(dimnames(x));
-#         rnames = dimnames(x)[[1]];
-#         cnames = dimnames(x)[[2]];
-#         # str("rnames, cnames: ");str(rnames);str(cnames);
-#         dmname = names(dimnames(x))[[loopdim]];
-#         dmnameStyle = createStyle(
-#             fontSize = 20,
-#             fontColour = "#4F81BD", #borderColour = "#4F81BD",
-#             # borderStyle = "medium", border = "Bottom",
-#             textDecoration = "bold")
-#         headerStyle = createStyle(halign = "center", valign = "center");
-#         lapply(
-#             seq_along(dimnames(x)[[loopdim]]),
-#             function(i) {
-#                 dmheader = paste(dmname, dimnames(x)[[loopdim]][i], sep = " = ")
-#                 writeData(wb, sheet, dmheader, startCol = 1, startRow = rw)
-#                 addStyle(wb, sheet, style = dmnameStyle, rows = rw, cols = 1);
-#                 rw <<- rw + 1;
-#                 writeDataTable(
-#                     wb, sheet,
-#                     x = as.data.frame(x[,,i]), # TODO: Generalize this to use loopdim!
-#                     colNames = TRUE, rowNames = TRUE,
-#                     withFilter = FALSE,
-#                     startCol = 1, startRow = rw,
-#                     tableStyle = tableStyle, headerStyle = headerStyle);
-#                 if (!is.null(style)) {
-#                     addStyle(wb, sheet, style = style, rows = rw + seq_along(rnames), cols = 1 + seq_along(cnames), gridExpand = TRUE, stack = TRUE);
-#                 }
-#                 cl = 1 + length(cnames) + 2;
-#
-#                 lapply(
-#                     seq_along(comparisons),
-#                     function(j) {
-#                         writeData(wb, sheet, names(comparisons)[j], startRow = rw - 1, startCol = cl)
-#                         addStyle(wb, sheet, style = dmnameStyle, rows = rw - 1, cols = cl);
-#
-#                         writeDataTable(
-#                             wb, sheet,
-#                             x = as.data.frame(comparisons[[j]][,,i]), # TODO: Generalize this to use loopdim!
-#                             colNames = TRUE, rowNames = TRUE,
-#                             withFilter = FALSE,
-#                             startCol = cl, startRow = rw,
-#                             tableStyle = tableStyle, headerStyle = headerStyle);
-#                         if (!is.null(comparisonStyle)) {
-#                             addStyle(wb, sheet, style = comparisonStyle, rows = rw + seq_along(rnames), cols = cl + seq_along(cnames), gridExpand = TRUE, stack = TRUE);
-#                         }
-#                         cl <<- cl + 1 + length(cnames) + 1;
-#                     }
-#                 )
-#                 rw <<- rw + length(rnames) + 1 + 2; # TODO: Generalize this to use loopdim!
-#             }
-#         );
-#     }
-# }
diff --git a/R/contractGrid.R b/R/contractGrid.R
index fc74c8d..9b3f08f 100644
--- a/R/contractGrid.R
+++ b/R/contractGrid.R
@@ -48,6 +48,7 @@
 #'         type of premium given in the \code{premium} parameter. One can,
 #'         however pass any other extractor function to access e.g. reserves,
 #'         cash flows etc. at any desired time.
+#' @returns multi-dimensional array of insurance contracts (dimensions defined by the axes argument)
 #'
 #' @rdname contractGrid
 #'
@@ -100,6 +101,7 @@ makeContractGridDimname.default = function(value) { value }
 #' representation for the axes in the grid.
 #'
 #' @param value the value along the axis, for which a name should be generated
+#' @returns The name of the entry in the dimnames of [makeContractGrid()]
 #' @describeIn makeContractGridDimname Create a short, human-readable dimensional name for an object (default S3 method)
 #' @examples
 #' library(MortalityTables)
@@ -119,6 +121,7 @@ makeContractGridDimname = function(value) { UseMethod("makeContractGridDimname",
 #' dimnames for all entries of the axes of a [contractGrid()] by calling
 #' \code{makeContractGridDimname} on each of the axes' values
 #' @param axes the axes with all names, for which a name should be generated
+#' @returns an array of dimnames derived from the axes definitions of [makeContractGrid()]
 #' @describeIn makeContractGridDimname Generate proper dimnames for all entries of the axes of a [contractGrid()]
 #' @export
 makeContractGridDimnames = function(axes) {
@@ -148,6 +151,7 @@ makeContractGridDimnames = function(axes) {
 #'         type of premium given in the \code{premium} parameter. One can,
 #'         however pass any other extractor function to access e.g. reserves,
 #'         cash flows etc. at any desired time.
+#' @returns a array of premiums (or other contract-specific value) for the grid defined by the \code{axes} argument to \code{contractGrid}
 #'
 #' @rdname contractGrid
 #' @export
diff --git a/R/exportInsuranceContractExample.R b/R/exportInsuranceContractExample.R
index a9cc5ed..f67f04f 100644
--- a/R/exportInsuranceContractExample.R
+++ b/R/exportInsuranceContractExample.R
@@ -5,7 +5,7 @@ NULL
 
 #' Export the example calculations of an insurance contract
 #'
-#' Export the given contract to excel (full history/timeseries of all cash
+#' Export the given contract to 'Excel' (full history/timeseries of all cash
 #' flows, reserves, premiums, etc.) and to a text file (sample calculation
 #' required by the Austrian regulation).
 #'
@@ -28,6 +28,7 @@ NULL
 #' @param extraname If basename is not given, this allows a suffix to distinguish
 #'       multiple exports.
 #' @param ... Further parameters (passed on to \code{\link{showVmGlgExamples}})
+#' @returns None
 #'
 #' @examples
 #' library("MortalityTables")
@@ -42,7 +43,7 @@ NULL
 #'     sumInsured = 1000,
 #'     contractClosing = as.Date("2016-10-01")
 #' );
-#' \dontrun{exportInsuranceContractExample(contract, prf = 10)}
+#' \donttest{exportInsuranceContractExample(contract, prf = 10)}
 #'
 #' @export
 exportInsuranceContractExample = function(contract, prf = 10, outdir = ".", basename=NULL, extraname = NULL, ...) {
diff --git a/R/exportInsuranceContract_xlsx.R b/R/exportInsuranceContract_xlsx.R
index 19c49f2..6c8ed15 100644
--- a/R/exportInsuranceContract_xlsx.R
+++ b/R/exportInsuranceContract_xlsx.R
@@ -846,10 +846,10 @@ exportCFTable = function(wb, sheet, contract, ccol = 1, crow = 1, styles = c(),
 #
 ############################################################################### #
 
-#' Export an insurance act object tocontract (object of class [InsuranceContract]) to an Excel file
+#' Export an insurance contract (object of class [InsuranceContract]) to an 'Excel' file
 #'
 #' @details The function \code{exportInsuranceContract.xlsx} exports an object
-#' of class [InsuranceContract] to an Excel file. All basic data, as well as
+#' of class [InsuranceContract] to an 'Excel' file. All basic data, as well as
 #' the time series of (absolute and unit) cash flows, reserves, premiums, premium
 #' composition and all profit participation scenarios are exported to the file
 #' in nicely looking tables.
@@ -858,7 +858,8 @@ exportCFTable = function(wb, sheet, contract, ccol = 1, crow = 1, styles = c(),
 #' stored in \code{contract$Values}.
 #'
 #' @param contract The insurance contract to export
-#' @param filename Target Excel filename for export
+#' @param filename Target 'Excel' file name for export
+#' @returns None
 #'
 #' @examples
 #' library("MortalityTables")
@@ -873,7 +874,7 @@ exportCFTable = function(wb, sheet, contract, ccol = 1, crow = 1, styles = c(),
 #'     sumInsured = 1000,
 #'     contractClosing = as.Date("2016-10-01")
 #' );
-#' \dontrun{exportInsuranceContract.xlsx(contract, "Example_annuity_contract.xlsx")}
+#' \donttest{exportInsuranceContract.xlsx(contract, "Example_annuity_contract.xlsx")}
 #' @export
 exportInsuranceContract.xlsx = function(contract, filename) {
   # TODO: argument checking for contract and filename
diff --git a/R/showVmGlgExamples.R b/R/showVmGlgExamples.R
index 3fff4d5..bb10d57 100644
--- a/R/showVmGlgExamples.R
+++ b/R/showVmGlgExamples.R
@@ -82,6 +82,7 @@ calcVmGlgExample = function(contract, prf = 10, t = 10, t_prf = 12, ...) {
 #' @param t_prf Time for which to show all values after the premium waiver
 #' @param file If given, outputs all information to the file rather than the console
 #' @param ... Further parameters for generating the contract for a tariff object
+#' @returns Name of the output file (invisible) or empty if printed to console
 #'
 #' @examples
 #' library(MortalityTables)
@@ -99,8 +100,8 @@ calcVmGlgExample = function(contract, prf = 10, t = 10, t_prf = 12, ...) {
 #' showVmGlgExamples(contract)
 #'
 #' # Optionally output to a file rather than the console:
-#' \dontrun{
-#' showVmGlgExamples(contract, file = "annuity-example.txt")
+#' \donttest{
+#' showVmGlgExamples(contract, file =  tempfile("annuity-example", fileext = ".txt"))
 #' }
 #' @export
 showVmGlgExamples = function(contract, prf = 10, t = 10, t_prf = 12, file = "", ...) {
@@ -169,6 +170,7 @@ showVmGlgExamples = function(contract, prf = 10, t = 10, t_prf = 12, file = "",
     );
     output.str = paste(output, collapse = '\r\n')
     cat(output.str, file = file)
+    invisible(file)
 }
 
 
@@ -189,16 +191,19 @@ showVmGlgExamples = function(contract, prf = 10, t = 10, t_prf = 12, file = "",
 #' @param net,Zillmer,gross,written,savings,risk,ZillmerRes,ZillmerRes.prf,VwKostenRes,VwKostenRes.prf,Bilanzreserve,Praemienuebertrag,Rueckkaufsreserve,Rueckkaufswert,Abschlusskostenruecktrag,Rueckkaufswert.prf,VS.prf Values as printed out by showVmGlgExamples
 #' @param absTolerance If non-NULL, will ignore small floating point differences. It uses same algorithm as all.equal()
 #' @param ... Further parameters for generating the contract for a tariff object
+#' @returns None
 #'
 #' @examples
 #' library(MortalityTables)
+#' library(testthat)
 #' mortalityTables.load("Austria_Annuities_AVOe2005R")
 #'
-#' \dontrun{
 #' test_that("Testtarif", {
 #'     # A trivial deferred annuity tariff with no costs:
+#'     library(MortalityTables)
+#'     mortalityTables.load("Austria_Annuities")
 #'     tariff = InsuranceTarif$new(name="Test Annuity", type="annuity",
-#'         mortalityTable = AVOe2005R.unisex, i=0.01)
+#'         mortalityTable = AVOe2005R.unisex, i = 0.01)
 #'     contract = InsuranceContract$new(
 #'         tariff,
 #'         age = 35, YOB = 1981,
@@ -218,15 +223,14 @@ showVmGlgExamples = function(contract, prf = 10, t = 10, t_prf = 12, file = "",
 #'         VwKostenRes = 0.00,
 #'         VwKostenRes.prf = 0.00,
 #'         Bilanzreserve = 9250.35,
-#'         Praemienuebertrag = 212.52,
+#'         Praemienuebertrag = 637.567,
 #'         Rueckkaufsreserve = 9011.40,
 #'         Rueckkaufswert = 9011.40,
 #'         Abschlusskostenruecktrag = 0.00,
 #'         Rueckkaufswert.prf = 9205.96,
-#'         VS.prf = 685.12
+#'         VS.prf = 684.117
 #'     )
 #' })
-#'}
 #'
 #' @export
 testVmGlgExample = function(contract, prf = 10, t = 10, t_prf = 12, net, Zillmer, gross, written, savings, risk,
@@ -318,6 +322,7 @@ testVmGlgExample = function(contract, prf = 10, t = 10, t_prf = 12, net, Zillmer
 #' @param prf Time of premium waiver (premium-free)
 #' @param t_prf Time for which to calculated all values after the premium waiver
 #' @param ... Further parameters for generating the contract for a tariff object
+#' @returns None (code is printed to the console, but no value returned)
 #'
 #' @examples
 #' library(MortalityTables)
diff --git a/README.md b/README.md
index dba4b1f..fa7572b 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
 R package implementing general life insurance contracts
 
 This package R6 classes to model traditional life insurance
-    contracts like annuities, whole life insurances or endowments. All relevant
-    quantities like premium decomposition, reserves and benefits over the whole
-    contract period are calculated and potentially exported to excel. Mortalities
-    are given using the MortalityTables package.
+contracts like annuities, whole life insurances or endowments. All relevant
+quantities like premium decomposition, reserves and benefits over the whole
+contract period are calculated and potentially exported to 'Excel'. Mortalities
+are given using the 'MortalityTables' package.
diff --git a/cran-comments.md b/cran-comments.md
new file mode 100644
index 0000000..6fa8126
--- /dev/null
+++ b/cran-comments.md
@@ -0,0 +1,14 @@
+## R CMD check results
+
+0 errors | 0 warnings | 1 note
+
+* Renamed the existing LifeInsuranceContracts package to LifeInsureR
+  So this is not a complately new package, just a new name!
+  
+* Re-submission of the package taking into account the response of the CRAN team:
+  * Wrap Software and package names in quotes
+  * There are no external references describing the methods
+  * Removed Umlaute (UTF8 characters) to prevent unexecutable code on pure ANSI/ASCII machines
+  * replace \dontrun by \donttest wherever possible.
+  * Never change the options(..)
+  
diff --git a/inst/Beispiele/Example_Endowment.R b/inst/Beispiele/Example_Endowment.R
index f959d5f..7d0a30a 100644
--- a/inst/Beispiele/Example_Endowment.R
+++ b/inst/Beispiele/Example_Endowment.R
@@ -78,10 +78,8 @@ contract.Bsp = InsuranceContract$
   addDynamics(t = 5, NewSumInsured = 200000, id = "Dynamik 1", i = 0.05, age = 70)$
   addDynamics(t = 10, NewSumInsured = 250000, id = "Dynamik 2", i = 0.01);
 
-options('LIC.debug.premiumCalculation' = TRUE)
 contract.Bsp$premiumWaiver(t = 13)
 
-options('LIC.debug.premiumCalculation' = FALSE)
 # exportInsuranceContractExample(contract.Bsp, t = 5);
 # showVmGlgExamples(contract.Bsp, t = 10)
 #
diff --git a/man/age.exactRounded.Rd b/man/age.exactRounded.Rd
index 71ae22f..cb32776 100644
--- a/man/age.exactRounded.Rd
+++ b/man/age.exactRounded.Rd
@@ -12,6 +12,9 @@ age.exactRounded(params, values)
 
 \item{values}{Unused by default (already calculated values of the contract)}
 }
+\value{
+the resulting age
+}
 \description{
 Calculate the age of the insured based on exact age at contract closing, rounded
 to the nearest birthday.
diff --git a/man/age.yearDifference.Rd b/man/age.yearDifference.Rd
index b972916..55876b1 100644
--- a/man/age.yearDifference.Rd
+++ b/man/age.yearDifference.Rd
@@ -12,6 +12,9 @@ age.yearDifference(params, values)
 
 \item{values}{Unused by default (already calculated values of the contract)}
 }
+\value{
+the resulting age
+}
 \description{
 Calculate the age of the insured based on the difference of the bith year and
 contract closing year.
diff --git a/man/contractGrid.Rd b/man/contractGrid.Rd
index 64fb64a..7a6aa06 100644
--- a/man/contractGrid.Rd
+++ b/man/contractGrid.Rd
@@ -42,6 +42,11 @@ type of premium given in the \code{premium} parameter. One can,
 however pass any other extractor function to access e.g. reserves,
 cash flows etc. at any desired time.}
 }
+\value{
+multi-dimensional array of insurance contracts (dimensions defined by the axes argument)
+
+a array of premiums (or other contract-specific value) for the grid defined by the \code{axes} argument to \code{contractGrid}
+}
 \description{
 The function \code{contractGrid} creates a (two- or multi-dimensional) grid
 of InsuranceContract objects, where each axis represents one of the insurance
diff --git a/man/deathBenefit.annuityDecreasing.Rd b/man/deathBenefit.annuityDecreasing.Rd
index 8eb7ac1..76042c9 100644
--- a/man/deathBenefit.annuityDecreasing.Rd
+++ b/man/deathBenefit.annuityDecreasing.Rd
@@ -9,6 +9,9 @@ deathBenefit.annuityDecreasing(interest)
 \arguments{
 \item{interest}{The interest rate of the loan, which is underlying the insurance.}
 }
+\value{
+vector of decreasing death benefits
+}
 \description{
 The death benefit will be the full sumInsured for the first year after the
 deferral period and then decrease like an annuity to 0 at the end of the policyPeriod.
diff --git a/man/deathBenefit.linearDecreasing.Rd b/man/deathBenefit.linearDecreasing.Rd
index b4f84ee..7a889c5 100644
--- a/man/deathBenefit.linearDecreasing.Rd
+++ b/man/deathBenefit.linearDecreasing.Rd
@@ -16,6 +16,9 @@ all inherited values from the tariff and the profit participation)}
 
 \item{values}{The values calculated from the insurance contract so far}
 }
+\value{
+vector of linearly decreasing benefits over the whole insurance coverage period
+}
 \description{
 The death benefit will be the full sumInsured for the first year after the
 deferral period and then decrease linearly to 0 at the end of the policyPeriod.
diff --git a/man/exportInsuranceContract.xlsx.Rd b/man/exportInsuranceContract.xlsx.Rd
index 7dad96f..bd44264 100644
--- a/man/exportInsuranceContract.xlsx.Rd
+++ b/man/exportInsuranceContract.xlsx.Rd
@@ -11,6 +11,9 @@ exportInsuranceContract.xlsx(contract, filename)
 
 \item{filename}{Target Excel filename for export}
 }
+\value{
+None
+}
 \description{
 Export an insurance act object tocontract (object of class \link{InsuranceContract}) to an Excel file
 }
@@ -37,5 +40,5 @@ contract = InsuranceContract$new(
     sumInsured = 1000,
     contractClosing = as.Date("2016-10-01")
 );
-\dontrun{exportInsuranceContract.xlsx(contract, "Example_annuity_contract.xlsx")}
+\donttest{exportInsuranceContract.xlsx(contract, "Example_annuity_contract.xlsx")}
 }
diff --git a/man/exportInsuranceContractExample.Rd b/man/exportInsuranceContractExample.Rd
index fad74ad..b434fc5 100644
--- a/man/exportInsuranceContractExample.Rd
+++ b/man/exportInsuranceContractExample.Rd
@@ -32,6 +32,9 @@ multiple exports.}
 
 \item{...}{Further parameters (passed on to \code{\link{showVmGlgExamples}})}
 }
+\value{
+None
+}
 \description{
 Export the given contract to excel (full history/timeseries of all cash
 flows, reserves, premiums, etc.) and to a text file (sample calculation
@@ -60,6 +63,6 @@ contract = InsuranceContract$new(
     sumInsured = 1000,
     contractClosing = as.Date("2016-10-01")
 );
-\dontrun{exportInsuranceContractExample(contract, prf = 10)}
+\donttest{exportInsuranceContractExample(contract, prf = 10)}
 
 }
diff --git a/man/freqCharge.Rd b/man/freqCharge.Rd
index cdf33b5..3fd7bd4 100644
--- a/man/freqCharge.Rd
+++ b/man/freqCharge.Rd
@@ -15,6 +15,9 @@ freqCharge(monthly = 0, quarterly = 0, semiannually = 0, yearly = 0)
 
 \item{yearly}{Surcharge for yearly premium payments (optiona, default is no surcharge)}
 }
+\value{
+a named list of surcharges for names 1 (yearly), 2 (semiannually), 4 (quarterly) and 12 (monthly) payments
+}
 \description{
 Tariffs are typically calculated with yearly premium installments. When
 premiums are paid more often then one a year (in advance), the insurance
diff --git a/man/isRegularPremiumContract.Rd b/man/isRegularPremiumContract.Rd
index f204dba..6288dab 100644
--- a/man/isRegularPremiumContract.Rd
+++ b/man/isRegularPremiumContract.Rd
@@ -11,6 +11,9 @@ isRegularPremiumContract(params, values)
 
 \item{values}{Unused by default (already calculated values of the contract)}
 }
+\value{
+TRUE or FALSE, indicating a contract with regular premiums
+}
 \description{
 Regular premium contracts are identified by the parameter \code{premiumPeriod > 1}.
 }
diff --git a/man/isSinglePremiumContract.Rd b/man/isSinglePremiumContract.Rd
index b69cc80..d76f80b 100644
--- a/man/isSinglePremiumContract.Rd
+++ b/man/isSinglePremiumContract.Rd
@@ -11,6 +11,9 @@ isSinglePremiumContract(params, values)
 
 \item{values}{Unused by default (already calculated values of the contract)}
 }
+\value{
+TRUE or FALSE, indicating a single-premium contract or not
+}
 \description{
 Single premium contracts are identified by the parameter \code{premiumPeriod = 1}.
 }
diff --git a/man/makeContractGridDimname.Rd b/man/makeContractGridDimname.Rd
index b09d322..25917b4 100644
--- a/man/makeContractGridDimname.Rd
+++ b/man/makeContractGridDimname.Rd
@@ -14,6 +14,11 @@ makeContractGridDimnames(axes)
 
 \item{axes}{the axes with all names, for which a name should be generated}
 }
+\value{
+The name of the entry in the dimnames of \code{\link[=makeContractGrid]{makeContractGrid()}}
+
+an array of dimnames derived from the axes definitions of \code{\link[=makeContractGrid]{makeContractGrid()}}
+}
 \description{
 The function \code{makeContractGridDimname} generates a short, human-readable
 dimension label for the entries along the axes of a \code{\link[=contractGrid]{contractGrid()}}.
diff --git a/man/premiumRefundPeriod.default.Rd b/man/premiumRefundPeriod.default.Rd
index 6b04c52..65e2a19 100644
--- a/man/premiumRefundPeriod.default.Rd
+++ b/man/premiumRefundPeriod.default.Rd
@@ -12,6 +12,9 @@ all inherited values from the tariff and the profit participation)}
 
 \item{values}{The values calculated from the insurance contract so far}
 }
+\value{
+The length of the premium refund period (deferral period for deferred contracts, contract period otherwise)
+}
 \description{
 If a premium refund is set for the tariff, the default is the full contract
 period, except for deferred contracts (typically deferred life annuities),
diff --git a/man/showVmGlgExamples.Rd b/man/showVmGlgExamples.Rd
index 7ce4288..3000cca 100644
--- a/man/showVmGlgExamples.Rd
+++ b/man/showVmGlgExamples.Rd
@@ -19,6 +19,9 @@ showVmGlgExamples(contract, prf = 10, t = 10, t_prf = 12, file = "", ...)
 
 \item{...}{Further parameters for generating the contract for a tariff object}
 }
+\value{
+Name of the output file (invisible) or empty if printed to console
+}
 \description{
 Display the values of the example calculation of the given insurance contract
 as required by the Austrian regulation (LV-VMGLV, "LV
@@ -40,7 +43,7 @@ contract = InsuranceContract$new(
 showVmGlgExamples(contract)
 
 # Optionally output to a file rather than the console:
-\dontrun{
-showVmGlgExamples(contract, file = "annuity-example.txt")
+\donttest{
+showVmGlgExamples(contract, file =  tempfile("annuity-example", fileext = ".txt"))
 }
 }
diff --git a/man/testVmGlgExample.Rd b/man/testVmGlgExample.Rd
index 2e68a94..2f68cc8 100644
--- a/man/testVmGlgExample.Rd
+++ b/man/testVmGlgExample.Rd
@@ -45,6 +45,9 @@ testVmGlgExample(
 
 \item{...}{Further parameters for generating the contract for a tariff object}
 }
+\value{
+None
+}
 \description{
 Check the values of the example calculation of the given insurance contract
 as required by the Austrian regulation (LV-VMGLV, "LV
@@ -57,13 +60,15 @@ The easiest way to write unit-tests is using the function \code{vmGlgExample.gen
 }
 \examples{
 library(MortalityTables)
+library(testthat)
 mortalityTables.load("Austria_Annuities_AVOe2005R")
 
-\dontrun{
 test_that("Testtarif", {
     # A trivial deferred annuity tariff with no costs:
+    library(MortalityTables)
+    mortalityTables.load("Austria_Annuities")
     tariff = InsuranceTarif$new(name="Test Annuity", type="annuity",
-        mortalityTable = AVOe2005R.unisex, i=0.01)
+        mortalityTable = AVOe2005R.unisex, i = 0.01)
     contract = InsuranceContract$new(
         tariff,
         age = 35, YOB = 1981,
@@ -83,14 +88,13 @@ test_that("Testtarif", {
         VwKostenRes = 0.00,
         VwKostenRes.prf = 0.00,
         Bilanzreserve = 9250.35,
-        Praemienuebertrag = 212.52,
+        Praemienuebertrag = 637.567,
         Rueckkaufsreserve = 9011.40,
         Rueckkaufswert = 9011.40,
         Abschlusskostenruecktrag = 0.00,
         Rueckkaufswert.prf = 9205.96,
-        VS.prf = 685.12
+        VS.prf = 684.117
     )
 })
-}
 
 }
diff --git a/man/vmGlgExample.generateTest.Rd b/man/vmGlgExample.generateTest.Rd
index ab53b8e..447f5c5 100644
--- a/man/vmGlgExample.generateTest.Rd
+++ b/man/vmGlgExample.generateTest.Rd
@@ -19,6 +19,9 @@ values is generated.}
 
 \item{...}{Further parameters for generating the contract for a tariff object}
 }
+\value{
+None (code is printed to the console, but no value returned)
+}
 \description{
 This function calculates the required reference values for the given
 insurance contract as required by the Austrian regulation (LV-VMGLV, "LV
diff --git a/tests/testthat/test-extendContract.R b/tests/testthat/test-extendContract.R
index e0a9f0f..9def190 100644
--- a/tests/testthat/test-extendContract.R
+++ b/tests/testthat/test-extendContract.R
@@ -28,20 +28,20 @@ test_that("Extend contract by $addExtension", {
 
 
     # premium-free extension
-    ContractB = ContractA$clone()$addExtension(id = "Verlängerung1", contractPeriod = 5, premiumPeriod = 0)
-    expect_equal(ContractB$blocks$Verlängerung1$Parameters$ContractData$sumInsured, 15117.03896)
+    ContractB = ContractA$clone()$addExtension(id = "Verlaengerung1", contractPeriod = 5, premiumPeriod = 0)
+    expect_equal(ContractB$blocks$Verlaengerung1$Parameters$ContractData$sumInsured, 15117.03896)
 
 
     # extension with given sumInsured resulting in 0 premiums
-    ContractC = ContractA$clone()$addExtension(id = "Verlängerung1", contractPeriod = 5, sumInsured = 15117.03896)
-    expect_equal(ContractC$blocks$Verlängerung1$Values$premiums[["gross"]], 0, tolerance = 1e-06)
+    ContractC = ContractA$clone()$addExtension(id = "Verlaengerung1", contractPeriod = 5, sumInsured = 15117.03896)
+    expect_equal(ContractC$blocks$Verlaengerung1$Values$premiums[["gross"]], 0, tolerance = 1e-06)
 
     # extension with increased sumInsured: real premiums are charged, reserves start from the existing reserve:
-    ContractD = ContractA$clone()$addExtension(id = "Verlängerung1", contractPeriod = 5, sumInsured = 20000)
-    expect_equal(ContractD$blocks$Verlängerung1$Values$premiums[["written"]], 315.109)
-    expect_equal(ContractD$blocks$Verlängerung1$Values$reserves[["0", "contractual"]], 10000)
+    ContractD = ContractA$clone()$addExtension(id = "Verlaengerung1", contractPeriod = 5, sumInsured = 20000)
+    expect_equal(ContractD$blocks$Verlaengerung1$Values$premiums[["written"]], 315.109)
+    expect_equal(ContractD$blocks$Verlaengerung1$Values$reserves[["0", "contractual"]], 10000)
 
     # extension with increased sumInsured and different tariff: check whether interest rate has really changed
-    ContractE = ContractA$clone()$addExtension(id = "Verlängerung1", contractPeriod = 5, sumInsured = 20000, tarif = Tarif.EndowmentB)
+    ContractE = ContractA$clone()$addExtension(id = "Verlaengerung1", contractPeriod = 5, sumInsured = 20000, tarif = Tarif.EndowmentB)
     expect_equal(unname(ContractE$Values$basicData[c(1,20,30,40), "InterestRate"]), c(0.03, 0.03, 0.01, 0.01))
 })
diff --git a/vignettes/creating-company-specific-implementations-as-package.Rmd b/vignettes/creating-company-specific-implementations-as-package.Rmd
index e7af991..739ff17 100644
--- a/vignettes/creating-company-specific-implementations-as-package.Rmd
+++ b/vignettes/creating-company-specific-implementations-as-package.Rmd
@@ -29,7 +29,6 @@ library(LifeInsureR)
 library(dplyr)
 library(tibble)
 library(lubridate)
-options(scipen=5)
 
 library(pander)
 ```
@@ -103,9 +102,8 @@ to validate the official numbers in the financial statements).
 ## Steps to implement batch-testing a whole (sub-)portfolio
 
 1.  Implement the corresponding products in the files in the `R/`
-    subdirectory. Use the LifeInsureR documentation for further details and guidance.
-    <!-- available at -->
-    <!-- <https://cran.r-project.org/package=LifeInsureR/vignettes/using-the-lifeinsurer-package.html> -->
+    subdirectory. Use the (LifeInsureR documentation)<using-the-lifeinsurer-package.html> 
+    for further details and guidance.
 2.  Install the package (using the "Install" button in RStudio's "Build"
     pane)
 3.  Set up the mapping of the columns of the contract data source to the
diff --git a/vignettes/using-the-lifeinsurer-package.Rmd b/vignettes/using-the-lifeinsurer-package.Rmd
index c95b254..a8a7ebf 100644
--- a/vignettes/using-the-lifeinsurer-package.Rmd
+++ b/vignettes/using-the-lifeinsurer-package.Rmd
@@ -28,7 +28,6 @@ library(LifeInsureR)
 library(dplyr)
 library(tibble)
 library(lubridate)
-options(scipen=5)
 
 library(pander)
 
@@ -1505,25 +1504,25 @@ ContractA = InsuranceContract$new(
 
 # premium-free extension
 ContractB = ContractA$clone()$
-  addExtension(id = "Verlängerung1", contractPeriod = 5, premiumPeriod = 0)
+  addExtension(id = "Verlaengerung1", contractPeriod = 5, premiumPeriod = 0)
 # sumInsured calculated from existing reserve:
-ContractB$blocks$Verlängerung1$Parameters$ContractData$sumInsured
+ContractB$blocks$Verlaengerung1$Parameters$ContractData$sumInsured
 ContractB$Values$basicData
 
 # extension with given sumInsured resulting in 0 (gross) premiums
 ContractC = ContractA$clone()$
-  addExtension(id = "Verlängerung1", contractPeriod = 5, sumInsured = 10723.07973354)
-ContractC$blocks$Verlängerung1$Values$premiums[["gross"]]
+  addExtension(id = "Verlaengerung1", contractPeriod = 5, sumInsured = 10723.07973354)
+ContractC$blocks$Verlaengerung1$Values$premiums[["gross"]]
 ContractC$Values$basicData
 
 # extension with increased sumInsured: real premiums are charged, reserves start from the existing reserve:
 ContractD = ContractA$clone()$
-  addExtension(id = "Verlängerung1", contractPeriod = 5, sumInsured = 20000)
+  addExtension(id = "Verlaengerung1", contractPeriod = 5, sumInsured = 20000)
 ContractD$Values$basicData
 
 # extension with regular premiums, which are given: sumInsured is calculated from it, reserves start from the existing reserve:
 ContractD = ContractA$clone()$
-  addExtension(id = "Verlängerung1", contractPeriod = 5, premium = 597.8771)
+  addExtension(id = "Verlaengerung1", contractPeriod = 5, premium = 597.8771)
 ContractD$Values$basicData
 ```
 
-- 
GitLab