Skip to contents

Recast the reporting triangle from wide to long format

Usage

enw_reporting_triangle_to_long(obs)

Arguments

obs

A data.frame in the format produced by enw_reporting_triangle().

Value

A long format reporting triangle as a data.frame with additional variables new_confirm and delay.

Examples

obs <- enw_example("preprocessed")$new_confirm
rt <- enw_reporting_triangle(obs)
enw_reporting_triangle_to_long(rt)
#> Key: <.group, reference_date, delay>
#>      reference_date .group  delay new_confirm
#>              <IDat>  <num> <fctr>       <int>
#>   1:     2021-07-14      1      0          22
#>   2:     2021-07-14      1      1          12
#>   3:     2021-07-14      1      2           4
#>   4:     2021-07-14      1      3           5
#>   5:     2021-07-14      1      4           0
#>  ---                                         
#> 796:     2021-08-22      1     15           0
#> 797:     2021-08-22      1     16           0
#> 798:     2021-08-22      1     17           0
#> 799:     2021-08-22      1     18           0
#> 800:     2021-08-22      1     19           0