check_date_seq.Rd
Used to check vectors of dates mainly to ensure that weather data are
complete. Invisibly returns a NULL
value if no errors are found, else
issues a warning()
with an informative message providing the user with
missing date values in the sequence and the optional location name if it's
provided.
check_date_seq(x, y = NULL)
A vector
of dates.
A vector
of values with location name, used for warning message.
No return value, called for side effects. Errors if the dates provided are not sequential.
# passes
x <- seq(as.Date("2021-01-01"), as.Date("2021-01-31"), by = "1 day")
y <- "BA"
check_date_seq(x = x, y = y)
#> Warning: The vectors do not contain sequential dates, , is/are missing.
#> non_sequential_date
# fails
x <- c(seq(as.Date("2021-01-01"), as.Date("2021-01-31"), by = "1 day"),
seq(as.Date("2021-02-02"), as.Date("2021-02-28"), by = "1 day"))
y <- "BA"
check_date_seq(x = x, y = y)
#> Warning: The vectors do not contain sequential dates, 2021-02-01, is/are missing for BA.
#> non_sequential_date