I would like to find the closest ranges that do not overlap from the first start to the last end position. Any idea how to proceed? In the example below c(8, 33) and c(155, 161) should be filtered out because they overlap with the preceding range.
#Example data
df <- data.frame(
start = c(7,8,14,34,67,92,125,155,170,200),
end = c(13,33,25,66,91,124,155,161,181,214)
)
start end
1 7 13
2 8 33
3 14 25
4 34 66
5 67 91
6 92 124
7 125 155
8 155 161
9 170 181
10 200 214
#Overlapping rows
start end
1 8 33
2 155 161
#Desired output where overlapping rows are filtered away
start end
1 7 13
2 14 25
3 34 66
4 67 91
5 92 124
6 125 155
7 170 181
8 200 214