seqToIntervals: Find contiguous sequences in a vector of integers
Description
Get all sequences of contiguous values in a vector of integers.
Usage
seqToIntervals(x)
Value
A matrix with one row for each sequence, and two columns containing
the start and the end of the sequence, respectively.
Arguments
x
A vector of integers, for example, representing
indices. x is coerced to integer, sorted, and unique values
extracted, if necessary, before finding the contiguous sequences.
Author
Chris Jackson <chris.jackson@mrc-bsu.cam.ac.uk>. Thanks to Tobias Verbeke for the suggestion.