`iv_diff()`
Closed this issue · 0 comments
DavisVaughan commented
Something like this:
iv_diff <- function(x) {
if (!all(vctrs::vec_detect_complete(x))) {
# Improve this
rlang::abort("Can't have incomplete values")
}
# Let iv() handle `start < end`?
size <- vctrs::vec_size(x)
start <- rlang::seq2(1L, size - 1L)
end <- rlang::seq2(2L, size)
start <- vctrs::vec_slice(x, start)
end <- vctrs::vec_slice(x, end)
iv(start, end)
}
Inspired by something like https://stackoverflow.com/questions/72062077/remove-overlaps-from-lubridate-intervals