Let's say I have this integer vector:
> int.vec
[1] 1 2 3 5 6 7 10 11 12 13
(created from int.vec <- c(1:3,5:7,10:13))
I'm looking for a function that will return the sum of the lengths of all intervals in this vector.
So basically for int.vec this function will return:
3+3+4 = 10