Description Usage Arguments Details Author(s) Examples
Find contiguous ranges of values in a vector of integers
1 | findRanges(x, output = "dt")
|
x |
a vector of integers |
output |
whether to output a data.table with columns start and end ("dt") or string ("str") |
if output = "dt" then a data.table with the start and end positions of contiguous ranges of integers in the vector. if output = "str" then each range is presented in a single string separated by commas e.g. "1-3,6-10,17-19"
Adam Waring - adam.waring@msdtc.ox.ac.uk
1 2 3 | x = sample(1:10, 5)
findRanges(x, "dt")
findRanges(x, "str")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.