decode_it | R Documentation |
Calculate the vector of data from its run length encoding.
decode_it(encodel)
encodel |
A list with two vectors: a numeric vector of encoded data and an integer vector of data counts (repeats). |
The function decode_it()
the vector of data from its run
length encoding.
The run length encoding of a vector consists of two vectors: a numeric vector of encoded data (consecutive data values) and of an integer vector of the data counts (the number of times the same value repeats in succession).
Run length encoding (RLE) is a data compression algorithm which encodes the data in two vectors: the consecutive data values and their counts. If a data value occurs several times in succession then it is recorded only once and its corresponding count is equal to the number of times it occurs. Run-length encoding is different from a contingency table.
A numeric vector
.
## Not run:
# Create a vector of data
datav <- sample(5, 31, replace=TRUE)
# Calculate the run length encoding of datav
rle <- HighFreq::encode_it(datav)
# Decode the data from its run length encoding
decodev <- HighFreq::decode_it(rle)
all.equal(datav, decodev)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.