data_as_of_df <- syn_nssp_df[syn_nssp_df$report_date <= "2026-04-01", ]
# Create triangle, max_delay is automatically computed
rep_tri <- suppressMessages(as_reporting_triangle(data = data_as_of_df))
# Check the maximum delay in the triangle
ncol(rep_tri)
# Truncate to 99th percentile of reporting
rep_tri_trunc <- truncate_to_quantile(rep_tri, p = 0.99)
ncol(rep_tri_trunc)
# More aggressive truncation
rep_tri_trunc90 <- truncate_to_quantile(rep_tri, p = 0.90)
ncol(rep_tri_trunc90)
Run the code above in your browser using DataLab