
Truncate reporting triangle by removing a specified number of the last rows
Source:R/truncate.R
truncate_to_row.RdRemoves the last t rows from a reporting triangle to simulate what would
have been observed at an earlier reference time.
Arguments
- reporting_triangle
A reporting_triangle object with rows representing reference times and columns representing delays. Can be a reporting matrix or incomplete reporting matrix. Can also be a ragged reporting triangle, where multiple columns are reported for the same row (e.g., weekly reporting of daily data).
- t
Integer indicating the number of timepoints to truncate off the bottom of the original reporting triangle.
- validate
Logical. If TRUE (default), validates the object. Set to FALSE only when called from functions that already validated.
Value
trunc_rep_tri A reporting_triangle object with t fewer rows
than the input. The class and metadata are preserved with updated reference
dates.
See also
Retrospective data generation functions
apply_reporting_structure(),
apply_reporting_structures(),
truncate_to_rows()
Examples
# Generate single truncated triangle
trunc_rep_tri <- truncate_to_row(example_reporting_triangle, t = 1)
trunc_rep_tri
#> Reporting Triangle
#> Delays unit: days
#> Reference dates: 2024-01-01 to 2024-01-04
#> Max delay: 3
#> Structure: 1
#>
#> 0 1 2 3
#> 2024-01-01 80 50 25 10
#> 2024-01-02 100 50 20 NA
#> 2024-01-03 90 45 NA NA
#> 2024-01-04 110 NA NA NA