Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit500dd60

Browse files
committed
CRAN_V1.0.0: Make check happy
* Add return value documentation* use tempdir for output in examples* Quote application names
1 parent32a2cb7 commit500dd60

16 files changed

+52
-21
lines changed

‎DESCRIPTION‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: LifeInsureR
22
Type: Package
3-
Version:1.0.0
4-
Date: 2023-10-20
5-
Title:Framework for Traditional Life Insurance Contracts
3+
Version:0.0.0.9999
4+
Date: 2023-10-27
5+
Title:Modelling Traditional Life Insurance Contracts
66
Description: R6 classes to model traditional life insurance
77
contracts like annuities, whole life insurances or endowments. Such life
88
insurance contracts provide a guaranteed interest and are not directly linked
@@ -14,8 +14,8 @@ Description: R6 classes to model traditional life insurance
1414
waivers). All relevant quantities like premium decomposition, reserves and
1515
benefits over the whole contract period are calculated and potentially
1616
exported to 'Excel'. Mortality rates are given using the 'MortalityTables' package.
17-
Authors@R: c(person("Reinhold", "Kainhofer", role=c("aut", "cre"), email="reinhold@kainhofer.com"))
18-
Author: Reinhold Kainhofer [aut, cre]
17+
Authors@R: c(person("Reinhold", "Kainhofer", role=c("aut", "cre", "cph"), email="reinhold@kainhofer.com"))
18+
Author: Reinhold Kainhofer [aut, cre, cph]
1919
Maintainer: Reinhold Kainhofer <reinhold@kainhofer.com>
2020
Encoding: UTF-8
2121
Imports:
@@ -43,7 +43,6 @@ Collate:
4343
'ProfitParticipation.R'
4444
'InsuranceTarif.R'
4545
'InsuranceContract.R'
46-
'addDataTableWorksheet.R'
4746
'contractGrid.R'
4847
'create_LIR_project.R'
4948
'exportInsuranceContract_xlsx.R'

‎R/HelperFunctions.R‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,7 @@ head0 = function(v, start = 0, value.start = 0) {
765765
#'
766766
#' @param v the vector to pad by repeating the last element
767767
#' @param ... arguments passed through to \code{pad0}
768+
#' @returns vector padded to the correct length
768769
#'
769770
#' @examples
770771
#' padLast(1:5, 7) # 5 is repeated twice
@@ -793,6 +794,7 @@ padLast = function(v, ...) {
793794
#' @param x The vector where NA-values should be filled by repeating the last preceeding non-NA value
794795
#' @param firstBack if \code{TRUE}, leading NAs are replaced by the first non-NA
795796
#' value in the vector, otherwise leading NAs are left untouched.
797+
#' @returns vector with NAs properly replaced
796798
#'
797799
#' @export
798800
fillNAgaps<-function(x,firstBack=FALSE) {
@@ -832,6 +834,8 @@ fillNAgaps <- function(x, firstBack=FALSE) {
832834
#' If \code{val} is a function, evaluate it, otherwise return \code{val}
833835
#' @param val Function or value
834836
#' @param ... Argument passed to \code{val} if it is a function
837+
#' @returns the value, potentially with the given function applied
838+
#'
835839
#' @examples
836840
#' valueOrFunction(3) # returns 3
837841
#' valueOrFunction(`+`, 1, 2) # also returns 3
@@ -850,6 +854,8 @@ valueOrFunction = function(val, ...) {
850854
#' @param hook (optional) function to apply to \code{val} and the other parameters
851855
#' @param val The value to which the hook is applied (ifgiven)
852856
#' @param ... optional parameters passed to the hook function (if it is a function)
857+
#' @returns the value with the hook function applied (if a function) or unchanged otherwiese
858+
#'
853859
#' @examples
854860
#' applyHook(NULL, 3) # returns 3 unchanged
855861
#' applyHook(function(x) 2*x, 3) # applies the function, returns 6
@@ -862,6 +868,7 @@ applyHook = function(hook, val, ...) {
862868
val
863869
}else {
864870
warning("Hook function",hook,"is neither a function nor NULL. Please provide a function or leave it empty!")
871+
val
865872
}
866873
}
867874

@@ -876,6 +883,7 @@ applyHook = function(hook, val, ...) {
876883
#'
877884
#' @param fields existing list
878885
#' @param valuelist list of fields to replace in \code{fields}. Only keys that exist in \code{fields} are overwritten, no new fields are added to \code{fields}
886+
#' @returns updated fields list
879887
#'
880888
#' @export
881889
fillFields=function(fields,valuelist) {
@@ -892,6 +900,7 @@ fillFields = function(fields, valuelist) {
892900
#' in fields are inserted
893901
#' @param fields existing list
894902
#' @param valuelist list of fields to replace in \code{fields}. Only keys that are missing in \code{fields} are added, no existing fields in \code{fields} are overwritten
903+
#' @return fields with missing values filled from the fallback data
895904
#' @export
896905
fallbackFields=function(fields,valuelist) {
897906
keepFields=!sapply(fields,is.null);

‎R/InsuranceContract.R‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,8 @@ InsuranceContract = R6Class(
456456
#' @param id The identifier of the contract block describing the dynamic
457457
#' increase. This is a free-form string that should be unique
458458
#' within the list of child blocks. It will be displayed in the
459-
#' Excel export feature and in the history snapshot list.
460-
#' @param ...Paramters to override in the dynamic block. By default,
459+
#''Excel' export feature and in the history snapshot list.
460+
#' @param ...Parameters to override in the dynamic block. By default,
461461
#' all parameters of the main contract block will be used, but
462462
#' they can be overridden per dynamic increase block.
463463
#'
@@ -951,7 +951,7 @@ InsuranceContract = R6Class(
951951
#' profit scenarios.
952952
#'
953953
#' @param id The unique ID of the profit scenario. Will be used as key
954-
#' in the list of profit scenarios and printed out in the Excel
954+
#' in the list of profit scenarios and printed out in the'Excel'
955955
#' export.
956956
#' @param ... Scenario-specific profit sharing parameters, overriding
957957
#' the default values. Typically, adjusted profit rates are required

‎R/InsuranceParameters.R‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ setCost = function(costs, type, basis = "SumInsured", frequency = "PolicyPeriod"
7070
#' even if the insured has already dies (for term-fix insurances)
7171
#' @param unitcosts Unit costs (absolute monetary amount, during premium period)
7272
#' @param unitcosts.PolicyPeriod Unit costs (absolute monetary amount, during full contract period)
73+
#'
74+
#' @returns an insurance cost structure (multi-dimensional matrix)
7375
#'
7476
#' @examples
7577
#' # empty cost structure (only 0 costs)

‎R/exportInsuranceContractExample.R‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ NULL
4343
#' sumInsured = 1000,
4444
#' contractClosing = as.Date("2016-10-01")
4545
#' );
46-
#' \donttest{exportInsuranceContractExample(contract, prf = 10)}
46+
#' \donttest{exportInsuranceContractExample(contract, prf = 10, outdir = tempdir())}
4747
#'
4848
#' @export
4949
exportInsuranceContractExample=function(contract,prf=10,outdir=".",basename=NULL,extraname=NULL,...) {

‎R/exportInsuranceContract_xlsx.R‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ exportCFTable = function(wb, sheet, contract, ccol = 1, crow = 1, styles = c(),
874874
#' sumInsured = 1000,
875875
#' contractClosing = as.Date("2016-10-01")
876876
#' );
877-
#' \donttest{exportInsuranceContract.xlsx(contract, "Example_annuity_contract.xlsx")}
877+
#' \donttest{exportInsuranceContract.xlsx(contract,tempfile("Example_annuity_contract", fileext = ".xlsx"))}
878878
#' @export
879879
exportInsuranceContract.xlsx=function(contract,filename) {
880880
# TODO: argument checking for contract and filename

‎man/InsuranceContract.Rd‎

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎man/applyHook.Rd‎

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎man/exportInsuranceContract.xlsx.Rd‎

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎man/exportInsuranceContractExample.Rd‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp