seqToIntervals

0th

Percentile

Gets all contigous intervals of a vector of indices

Gets all contigous intervals of a vector of indices.

Keywords
attribute
Usage
## S3 method for class 'default':
seqToIntervals(idx, ...)
Arguments
idx
A vector of integer indices.
...
Not used.
See Also

*intervalsToSeq(). To identify sequences of equal values, see rle().

Aliases
  • seqToIntervals.default
  • seqToIntervals
Examples
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))
Documentation reproduced from package R.utils, version 1.28.4, License: LGPL (>= 2.1)

Community examples

Looks like there are no examples yet.