Adds missing sequence to a data frame. All missing values between the minimum and maximum values with the smallest interval in the data are added.
ps_add_missing_sequence(x, sequence = "DateTime", by = character(0))
A tbl data frame sorted by DateTime.
datetime <- as.POSIXct("2001-01-02 03:04:06") + c(1, 3, 9)
ps_add_missing_sequence(data.frame(DateTime = datetime, Value = c(1, 3, 9)))
#> # A tibble: 5 × 2
#> DateTime Value
#> <dttm> <dbl>
#> 1 2001-01-02 03:04:07 1
#> 2 2001-01-02 03:04:09 3
#> 3 2001-01-02 03:04:11 NA
#> 4 2001-01-02 03:04:13 NA
#> 5 2001-01-02 03:04:15 9