powered by
rle()
rle2(x)## S3 method for class 'rle2': print(x, digits = getOption("digits"), prefix = "", ...)
## S3 method for class 'rle2': print(x, digits = getOption("digits"), prefix = "", ...)
"rle"
inverse.rle()
print.default
lengths
inverse.rle() is the inverse function of rle2() and rle(), reconstructing x from the runs.
rle2()
x
x <- rev(rep(6:10, 1:5)) rle(x) ## lengths [1:5] 5 4 3 2 1 ## values [1:5] 10 9 8 7 6 rle2 ## lengths: int [1:5] 5 4 3 2 1 ## values : int [1:5] 10 9 8 7 6 ## indices: int [1:5] 5 9 12 14 15
Run the code above in your browser using DataLab