seqToIntervals
From R.utils v2.10.1
by Henrik Bengtsson
Gets all contiguous intervals of a vector of indices
Gets all contiguous intervals of a vector of indices.
- Keywords
- attribute
Usage
# S3 method for default
seqToIntervals(idx, ...)
Arguments
Value
See Also
*intervalsToSeq()
.
To identify sequences of equal values, see rle
().
Examples
# NOT RUN {
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))
# }
Community examples
Looks like there are no examples yet.