RLE is run-length encoding, it is a form of lossless data compression based on sequences in which the same data value occurs in many consecutive data elements (typical usage e.g. in simple graphic images such as icons, line drawings, animations). Use this tag for questions about this type of encoding/compression. Do not use this tag for common issues about encoding/compression.
rle()
computes the lengths and values of runs of equal values in a vector -- or the reverse operation with inverse.rle()
.
rle()
returns an object of class "rle"
which is a list with components:
lengths: an integer vector containing the length of each run.
values: a vector of the same length as lengths with the corresponding values.
inverse.rle()
returns an atomic vector.