Skip to content

Instantly share code, notes, and snippets.

@00joshi
00joshi / Lubridate Net Intervals
Created January 10, 2019 13:38
remove overlap from a vector of lubridate intervals in R
# The function takes a vector of lubridate intervals and removes overlap
require(lubridate)
# A vector of test intervals
test_c <- c(interval(ymd("2019-01-10"),ymd("2019-01-13")),
interval(ymd("2019-12-9"),ymd("2019-12-10")),
interval(ymd("2019-1-12"),ymd("2019-1-1"))
)

Keybase proof

I hereby claim:

  • I am 00joshi on github.
  • I am jochenl (https://keybase.io/jochenl) on keybase.
  • I have a public key ASB-bfs1gGk3AFPijkm4FYGqGJnoHqi1KfQM_dgT1lATswo

To claim this, I am signing this object: