Check Dates for Sequentialness and Completeness
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.
Value
No return value, called for its side-effects, validates that dates are sequential and errors if they are not in order or some are missing.
Author
Adam H. Sparks, adamhsparks@gmail.com
Examples
# 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)
# 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 location BA.