rrle: Recursive run length encoding.

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/rrle.R

Description

Encode a matrix as run-length, top down. Encoding respects previous runs, e.g line 2 encodes runs in each run of line 1.

Usage

1
rrle(x, collapseNA =FALSE)

Arguments

x

a matrix.

collapseNA

boolean. Collapse runs of NA.

Details

By default, different NA data are not considered equal. collapseNA collapses runs of NA in the result. For recursion however they are treated as singular data, not as runs. This may need discussion.

Value

list of run length encoded lines

Note

This could go to rle in package base.

The date structure used for rle would be better represented as a data.frame.

Run length and other compressions might be implemented in data.frames by default.

Author(s)

Günther Sawitzki <[email protected]>

See Also

rrleb

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x <- matrix(c(
	 1,1,1,2,2,
	 3,3,4,4,4,
	 5,5,6,6,7,
	 8,9,9,0,0
 ),nrow=4, ncol =5, byrow=TRUE)
 xrrle <- rrle(x)
 xrrle

 t(sapply(xrrle, inverse.rle))

sprof documentation built on May 31, 2017, 1:56 a.m.