Roland Rau <roland.rproject <at> gmail.com> writes:

> 
> does this do what you want?
> 
> overlap <- function(a,b,c,d) {
>       all(c:d %in% a:b)
> }
> overlap(1,5,3,4)
> overlap(1,2,3,4)

  Do you really want this to be discrete?  How about

overlap <- function(a,b,c,d) {
   a<c && b>d
}

(although this assumes that a<b and c<d ...)

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to