header_tag.html

Skip to contents

Fix overlap between historic and current continuous data. This is needed because sometimes the historic and hot data will overlap. This will make sure the data with the more recent "last_modified" will have priority.

Usage

fix_continuous_overlap(df)

Arguments

df

Data frame with at least time_series_id, time, last_modified

Value

Data frame with duplicated data removed

Examples


df1 <- data.frame(
     time = c(seq.Date("2026-01-01", "2026-01-07"),
              seq.Date("2026-01-05", "2026-01-09")),
     last_modified = c(rep("2026-01-07", 7),
                       rep("2026-01-09", 5)),
     value = 1:12,
     time_series_id = "a"
)

fix_continuous_overlap(df1)
#>   time_series_id       time last_modified value
#> 1              a 2026-01-01    2026-01-07     1
#> 2              a 2026-01-02    2026-01-07     2
#> 3              a 2026-01-03    2026-01-07     3
#> 4              a 2026-01-04    2026-01-07     4
#> 5              a 2026-01-05    2026-01-09     8
#> 6              a 2026-01-06    2026-01-09     9
#> 7              a 2026-01-07    2026-01-09    10
#> 8              a 2026-01-08    2026-01-09    11
#> 9              a 2026-01-09    2026-01-09    12