drle-class | R Documentation |
The drle
class stores delta-run-length-encoded vectors. These differ from other run-length-encoded vectors provided by other packages in that they allow for runs of values that each differ by a common difference (delta).
## Instance creation
drle(x, type = "drle", cr_threshold = 0)
is.drle(x)
## Additional methods documented below
x |
An integer or numeric vector to convert to delta run length encoding for |
type |
The type of compression to use. Must be "drle", "rle", or "seq". The default ("drle") allows arbitrary deltas. Using type "rle" means that runs must consist of a single value (i.e., deltas must be 0). Using type "seq" means that deltas must be 1, -1, or 0. |
cr_threshold |
The compression ratio threshold to use when converting a vector to delta run length encoding. The default (0) always converts the object to |
An object of class drle
.
values
:The values that begin each run.
lengths
:The length of each run.
deltas
:The difference between the values of each run.
drle
instances can be created through drle()
.
Standard generic methods:
x[i]
:Get the elements of the uncompressed vector.
length(x)
:Get the length of the uncompressed vector.
c(x, ...)
:Combine vectors.
Kylie A. Bemis
rle
## Create a drle vector
x <- c(1,1,1,1,1,6,7,8,9,10,21,32,33,34,15)
y <- drle(x)
# Check that their elements are equal
x == y[]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.