| Extract.rle {rle} | R Documentation | 
Indexing Methods for rle Objects
Description
These methods are defined and produce an error (except
for character input) to future-proof code that depends on the
rle package by preventing their use.
Usage
## S3 method for class 'rle'
x[i, ...]
## S3 replacement method for class 'rle'
x[i, ...] <- value
## S3 method for class 'rle'
x[[i, ...]]
## S3 replacement method for class 'rle'
x[[i, ...]] <- value
## S3 method for class 'rle'
x$name
## S3 replacement method for class 'rle'
x$name <- value
Arguments
| x,i,name,value,... | Arguments to indexing operators. See
Extract documentation in the  | 
Details
At this time, the rle package does not support indexing
operations by logical or numeric indices, but it is
likely to do so in the future. Therefore, we reserve the syntax
now to prevent users of this package from relying on the default
behaviour of the indexing operators.
Value
At this time, all functions raise an error except for
character indices. This behaviour can be overridden by
setting options(rle.unclass_index=TRUE), which effectively
unclasses the objects before indexing.
Examples
# Indexing by character or by $ works, including sub-indexing.
x <- rle(1:5)
x[["values"]] <- 2:6
x
x$values[2:3] <- 7:8
x
## Not run: 
# Numerical indexing doesn't, unless `options(rle.unclass_index=TRUE)` is set.
x[1]
x[[1]]
## End(Not run)
[Package rle version 0.9.2 Index]