dataset <-
tibble::tibble(Id = c("A", "A", "A", "B", "B", "B"),
Datetime = lubridate::as_datetime(1) +
lubridate::days(c(0:2, 4, 6, 8)) +
lubridate::hours(c(0,12,rep(0,4)))) %>%
dplyr::group_by(Id)
dataset
#look for gaps assuming the epoch is the dominant epoch of each group
gap_finder(dataset)
#return the gaps as a tibble
gap_finder(dataset, gap.data = TRUE)
#assuming the epoch is 1 day, we have different gaps, and the datapoint at noon is now `irregular`
gap_finder(dataset, epoch = "1 day")
Run the code above in your browser using DataLab