If I have a data frame of ranges:
start end
12 18
22 30
35 40
49 70
81 90
102 110
120 124
How do I get rows with distances within certain lower and upper threshold in R (i.e. the start of the next row - the end of the previous row is within that threshold)?
Let's say, I want to get rows with distances between 5-10, then I would want to get:
start.1 end.1 start.2 end.2
22 30 35 40
35 40 49 70
102 110 120 124
Here, start.2 - end.1 is always between 5-10.