[R] overlap between line segments

2015-07-13 Thread Karla Shikev
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 my samples distributed along a transect and my data refer to the first and last occurrences of each sample. For instance: > dat

Re: [R] overlap between line segments

2015-07-14 Thread Karla Shikev
if(x[2,2] > x[1,2]) overlap<-x[1,2]-x[2,1] > else overlap<-x[2,2]-x[2,1] > } > else { > if(x[1,2] > x[2,2]) overlap<-x[2,2]-x[1,1] > else overlap<-x[1,2]- x[1,1] > } > if(overlap < 0) overlap<-0 > return(overlap) > } > > Jim &