Skip to contents

Convert reporting_triangle to data.frame

Usage

# S3 method for class 'reporting_triangle'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

Arguments

x

A reporting_triangle object to convert.

row.names

NULL or character vector giving row names for the data frame. Missing values are not allowed.

optional

Logical. If TRUE, setting row names and converting column names is optional.

...

Additional arguments to be passed to or from methods.

Value

A data.frame with columns reference_date, report_date, delay, count

Examples

# Convert reporting triangle to data frame
df <- as.data.frame(example_reporting_triangle)
head(df)
#>   reference_date report_date delay count
#> 1     2024-01-01  2024-01-01     0    80
#> 2     2024-01-02  2024-01-02     0   100
#> 3     2024-01-03  2024-01-03     0    90
#> 4     2024-01-04  2024-01-04     0   110
#> 5     2024-01-05  2024-01-05     0    95
#> 6     2024-01-01  2024-01-02     1    50