(x <- c(0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1))
(ranges <- clustersegment(x))
# The first sequence of 1's in x lies in the interval
(r <- ranges[1,1]:ranges[2,1])
x <- matrix(as.numeric(runif(30) > 0.4), 3, 10)
ranges <- clustersegment(x)
x <- c(0, 1.2, 3, -8, 0)
ranges <- clustersegment(x)
Run the code above in your browser using DataLab