Sectioned density plots

Get all sequences of contiguous values in a vector of integers.

1 |

`x` |
A vector of integers, for example, representing
indices. |

A matrix with one row for each sequence, and two columns containing the start and the end of the sequence, respectively.

Chris Jackson <chris.jackson@mrc-bsu.cam.ac.uk>. Thanks to Tobias Verbeke for the suggestion.

1 2 3 4 | ```
seqToIntervals(1:10) # [1 10]
seqToIntervals(c(1:10, 15:18, 20)) # [1 10; 15 18; 20 20]
# vectorised, so efficient for large vectors x
seqToIntervals(sample(1:1000000, size=999990))
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.