seqToIntervals | R Documentation |
Gets all contiguous intervals of a vector of indices.
## Default S3 method:
seqToIntervals(idx, ...)
idx |
A |
... |
Not used. |
An Nx2 integer
matrix
.
Henrik Bengtsson
*intervalsToSeq()
.
To identify sequences of equal values, see rle
().
x <- 1:10
y <- seqToIntervals(x)
print(y) # [1 10]
x <- c(1:10, 15:18, 20)
y <- seqToIntervals(x)
print(y) # [1 10; 15 18; 20 20]
z <- intervalsToSeq(y)
print(z)
stopifnot(all.equal(x,z))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.