encode_it | R Documentation |
Calculate the run length encoding of a single-column time series, matrix, or a vector.
encode_it(tseries)
tseries |
A single-column time series, matrix, or a vector. |
The function encode_it()
calculates the run length encoding of a
single-column time series, matrix, or a vector.
The run length encoding of a vector consists of two vectors: a 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 list with two vectors: a vector of encoded data and an integer vector of data counts (repeats).
## Not run:
# Create a vector of data
datav <- sample(5, 31, replace=TRUE)
# Calculate the run length encoding of datav
HighFreq::encode_it(datav)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.