Skip to contents

This function can be used after creating excel worksheets with add_sicr_worksheet() to derive worksheets as aggregate of these. Addition and subtraction are supported to allow for a net after reinsurance perspective.

Usage

add_sicr_aggr_worksheet(
  workbook,
  sheetname,
  sheets_to_add = NULL,
  sheets_to_subtract = NULL
)

Arguments

workbook

Workbook created via openxlsx2::wb_workbook().

sheetname

Desired sheet name.

sheets_to_add

Vector with the names of the sheets that shall be added.

sheets_to_subtract

Vector with the names of the sheets that shall be subtracted.

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 = "add1",
                               payments = payments,
                               reserved = all_claims_reserved_xmpl)
workbook <- add_sicr_worksheet(workbook = workbook,
                               sheetname = "add2",
                               payments = payments,
                               reserved = all_claims_reserved_xmpl)
workbook <- add_sicr_worksheet(workbook = workbook,
                               sheetname = "sub1",
                               payments = payments,
                               reserved = all_claims_reserved_xmpl)

workbook <- add_sicr_aggr_worksheet(workbook = workbook,
                                   sheetname = "Sum_sheet",
                                   sheets_to_add = c("add1", "add2"),
                                   sheets_to_subtract = c("sub1"))

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