rangesoverlap: tells if two ranges overlap

Description Usage Arguments Value Examples

View source: R/Distances.R

Description

tells if two ranges overlap

Usage

1
rangesoverlap(r1, r2)

Arguments

r1

a range a length 2 numerical vector

r2

a range a length 2 numerical vector

Value

TRUE if two ranges overlap

Examples

1
2
3
4
5
6
7
8
par(mfrow=c(1,4),oma=c(0,0,0,0))
set.seed(8);replicate(4,(function(){
r1<-sample(1:8,2);r2<-sample(1:5,2)
plot(cbind(c(r1,r2),0),yaxt='n',xlab='',ylab='',xaxt='n',
main=paste0(if(rangesoverlap(r1,r2)){"O"}else{"Does not o"},"verlap"))
points(cbind(r1,0),type="l",lwd=3)
points(cbind(r2,0),type="l",col="red")
})())

DanielBonnery/Strategy documentation built on Dec. 17, 2021, 4:03 p.m.