ranges.gap: Interval length between two ranges (0 if they overlap)

Description Usage Arguments Value Examples

View source: R/Distances.R

Description

Interval length between two ranges (0 if they overlap)

Usage

1
ranges.gap(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(10);replicate(4,(function(){
r1<-sample(1:8,2);r2<-sample(1:5,2)
plot(cbind(c(r1,r2),0),yaxt='n',xlab='',ylab='',
main=paste0("Gap: ",ranges.gap(r1,r2)))
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.