Description Usage Arguments Details Value Examples
Summarisation functions for vectors described in Summary are implemented for rle
objects.
1 2 
... 

na.rm 
Whether the missing values should be ignored ( 
Supported functions include all elements of the S3
Summary group. As of this writing, functions supported include
(from R help) all
, any
, max
, min
, prod
, range
, and
sum
.
In every supported case, the call should produce the same
result as what would have resulted had the call been applied to
the original (uncompressed) vector. (At no point in the
calculation is the uncompressed vector actually constructed, of
course.) The exception is that if values
are of class
integer
, the result will nonetheless always be upcast to
numeric
to avert overflows. This behaviour may change in the
future.
1 2 3 4 5 6 7 8 9 10 11 12  x < rle(as.logical(rbinom(20,1,.7)))
y < rle(as.logical(rbinom(20,1,.3)))
stopifnot(isTRUE(all.equal(any(x, y),any(inverse.rle(x), inverse.rle(y)))))
stopifnot(isTRUE(all.equal(any(y),any(inverse.rle(y)))))
stopifnot(isTRUE(all.equal(sum(inverse.rle(x),inverse.rle(y)),sum(x,y))))
stopifnot(isTRUE(all.equal(sum(inverse.rle(y)),sum(y))))
y$values[2:3] < NA
stopifnot(isTRUE(all.equal(sum(inverse.rle(y), na.rm=TRUE),sum(y, na.rm=TRUE))))
stopifnot(isTRUE(all.equal(sum(inverse.rle(y), na.rm=FALSE),sum(y, na.rm=FALSE))))

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.