## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ## ----setup-------------------------------------------------------------------- library(vitopack) ## ----build-triangle----------------------------------------------------------- df <- data.frame( origin = c(1, 1, 1, 2, 2, 3), dev = c(0, 1, 2, 0, 1, 0), paid = c(10, 5, 2, 20, 7, 15) ) trg <- create_triangle(df, row_num = "origin", col_num = "dev", value = "paid") trg ## ----chl---------------------------------------------------------------------- cum <- create_cumulative_triangle(trg) create_chl_coefs(cum, chl_length = c("full", 2)) ## ----chl-weighted------------------------------------------------------------- weight <- matrix(1, nrow = nrow(cum), ncol = ncol(cum)) weight[is.na(cum)] <- NA create_chl_coefs_weighted(cum, weight, chl_length = "full") ## ----exposure----------------------------------------------------------------- policies <- data.frame( policy_start = as.Date(c("2024-01-15", "2024-06-01")), policy_end = as.Date(c("2024-12-31", "2025-05-31")) ) create_policy_exposure_columns_m( data = policies, exp_names = c("exp_q1", "exp_q2", "exp_q3", "exp_q4"), start_months = c("2024-01-01", "2024-04-01", "2024-07-01", "2024-10-01"), end_months = c("2024-03-31", "2024-06-30", "2024-09-30", "2024-12-31"), start_policy_var = "policy_start", end_policy_var = "policy_end" ) ## ----rc----------------------------------------------------------------------- rc_to_birth_day("900615/1234") # man, 1990-06-15 rc_to_birth_day("055615/1234") # woman, 2005-06-15 rc_to_birth_day_2("240615/1234") # cut-off 25 → 2024-06-15 ## ----palette, fig.width = 6, fig.height = 1.5--------------------------------- rgb_df <- rgb_colors_for_plot() get_colors_duo(rgb_df, 8) ## ----palette-bars, eval = interactive()--------------------------------------- # plot_color_bars(12)