[R-sig-eco] altitudinal overlap

Karla Shikev karlashikev at gmail.com
Tue Jul 14 01:03:29 CEST 2015


Hi there,

This is a newbie question, and I'm sure there are simple ways to do this,
but I've spent my entire afternoon and I couldn't get it to work.

Imagine that I got the altitudinal range of different species. For instance:

> dat<-matrix(c(1,3,2.5,4), ncol=2, byrow=TRUE)
> dat
     [,1] [,2]
[1,]  1.0    3
[2,]  2.5    4


The first line indicates that this species is found between 1 and 3,
whereas the second species was found between 2.5 and 4.

I need a simple way to calculate the overlap of their extents (0.5 in this
case). This way should provide 0 if there is no overlap, and it should also
work in the case where one subject is found only within the extent of the
second subject.

Any help will be greatly appreciated.

Karla

	[[alternative HTML version deleted]]



More information about the R-sig-ecology mailing list