drle-class: Delta Run Length Encoding

Description Usage Arguments Value Slots Creating Objects Methods Author(s) See Also Examples

Description

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).

Usage

1
2
3
4
5
## Instance creation
drle(x, cr_threshold = 0, delta = TRUE)

is.drle(x)
## Additional methods documented below

Arguments

x

An integer or numeric vector to convert to delta run length encoding for drle(); an object to test if it is of class drle for is.drle().

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 drle. Values of cr_threshold < 1 correspond to compressing even when the output will be larger than the input (by a certain ratio). For values > 1, compression will only take place when the output is (approximately) at least cr_threshold times smaller.

delta

Should non-zero deltas be considered by the encoding? (Default TRUE.) If FALSE, then ordinary run-length-encoding is used.

Value

An object of class drle.

Slots

values:

The values that begin each run.

lengths:

The length of each run.

deltas:

The difference between the values of each run.

Creating Objects

drle instances can be created through drle().

Methods

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.

Author(s)

Kylie A. Bemis

See Also

rle

Examples

1
2
3
4
5
6
## 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[]

matter documentation built on Nov. 8, 2020, 6:15 p.m.