Skip to contents

Filter observations to be the latest available reported data for each reference date. Note this is not the same as filtering for the maximum report date in all cases as data may only be updated up to some maximum number of days.

Usage

enw_latest_data(obs)

Arguments

obs

A data.frame; must have report_date and reference_date columns.

Value

A data.table of observations filtered for the latest available data for each reference date.

Examples

# Filter for latest reported data
enw_latest_data(germany_covid19_hosp)
#>        reference_date location age_group confirm report_date
#>                <IDat>   <fctr>    <fctr>   <int>      <IDat>
#>     1:     2021-04-06       DE       00+     708  2021-06-26
#>     2:     2021-04-06       DE     00-04      11  2021-06-26
#>     3:     2021-04-06       DE     05-14       5  2021-06-26
#>     4:     2021-04-06       DE     15-34      75  2021-06-26
#>     5:     2021-04-06       DE     35-59     192  2021-06-26
#>    ---                                                      
#> 23558:     2021-10-20    DE-TH     05-14       1  2021-10-20
#> 23559:     2021-10-20    DE-TH     15-34       2  2021-10-20
#> 23560:     2021-10-20    DE-TH     35-59       1  2021-10-20
#> 23561:     2021-10-20    DE-TH     60-79       5  2021-10-20
#> 23562:     2021-10-20    DE-TH       80+       5  2021-10-20