Skip to contents

This function adds a properly formatted worksheet with payments and reserves information to an existing workbook.

Usage

add_sicr_worksheet(workbook, sheetname, payments, reserved = NULL)

Arguments

workbook

Workbook created via openxlsx2::wb_workbook().

sheetname

Desired sheet name.

payments

Numeric matrix of historic and future payments with origin years as rownames and origin years + 250 as calendar years as colnames.

reserved

Default: NULL. Numeric matrix with historic payments. Not considered if NULL.

Value

Workbook including the new sheet.

Examples

future_payments <- matrix(0, 35, 250)
colnames(future_payments) <- 2024:2273
future_payments[,1] <- 1e6 # some entries to show functionality

payments <- cbind(all_claims_paid_xmpl, future_payments)

workbook <- openxlsx2::wb_workbook()
workbook <- add_sicr_worksheet(workbook = workbook,
                               sheetname = "new_sheet",
                               payments = payments,
                               reserved = all_claims_reserved_xmpl)

# either open with openxlsx2::wb_open(workbook) or save via openxlsx2::wb_save(workbook)