Different validation checks for sequence of timestamps

isValidTimestampSequence(
  timestamps,
  checks = c("sorted", "duplicates", "timestep"),
  dbg = FALSE
)

Arguments

timestamps

vector of timestamps of class POSIXt

checks

Vector of character indicating the checks to be performed. Available checks: "sorted", "duplicates", "timestep". Default: perform all tests

dbg

shall debug messages be shown?

Examples

timestamps <- sequenceOfTimestamps("2017-11-03", "2017-11-04", 3600) times <- as.POSIXct(timestamps) isValidTimestampSequence(times)
#> [1] TRUE
isValidTimestampSequence(rev(times))
#> Warning: #> *** The timestamps are not sorted!
#> [1] FALSE
isValidTimestampSequence(timestamps = c(times[1], times))
#> Warning: #> *** The time step between timestamps is not unique: 0, 3600 (secs) #> #> *** The timestamps contain 1 duplicates such as: #> '2017-11-03 00:00:00'
#> [1] FALSE