Skip to content

Instantly share code, notes, and snippets.

@danielecook
Last active December 7, 2017 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielecook/2a874880930ab1c22627fcc7d0a7aeda to your computer and use it in GitHub Desktop.
Save danielecook/2a874880930ab1c22627fcc7d0a7aeda to your computer and use it in GitHub Desktop.
R is overlapping #R
is_overlapping <- function(start_1, end_1, start_2, end_2) {
if (
(dplyr::between(start_1, start_2, end_2)) |
(dplyr::between(end_1, start_2, end_2)) |
(dplyr::between(start_2, start_1, end_1)) |
(dplyr::between(end_2, start_1, end_1))
) {
return(TRUE)
}
FALSE
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment