Skip to content
Prev 261547 / 398502 Next

Identifying sequences

Something like this?

a=1:10
b=20:30
c=40:50
x=c(a,b,c)
borders <- which(diff(x) != 1)
seqs <- data.frame(start = c(1, borders + 1), end = c(borders, length(x)))

Best regards,

Thierry