Class for hybrid index representation, plain and rle-packed
hi(from, to, by = 1L, maxindex = NA, vw = NULL, pack = TRUE, NAs = NULL)
# S3 method for hi
print(x, ...)
# S3 method for hi
str(object, nest.lev=0, ...)
A list of class 'hi' with components
directly accessed by the C-code: the sorted index of class 'rlepack' as returned by rlepack
NULL or positions to restore original order
logical scalar indicating if sequence was reversed from descending to ascending (in this case is.null(ix)
)
directly accessed by the C-code: represents the lowest positive subscript to be enumerated in case of negative subscripts
directly accessed by the C-code: represents the highest positive subscript to be enumerated in case of negative subscripts
number of subscripts, whether negative or positive, not the number of selected elements
NULL or dim -- used by as.matrix.hi
NULL or dimorder
logical scalar indicating whether we have a symmetric matrix
logical scalar indicating whether we have a fixed diagonal (can only be true for symmetric matrices)
virtual window information vw
NULL or NA positions as returned by rlepack
integer vector of lower sequence bounds
integer vector of upper sequence bounds
integer of stepsizes
maximum indep position (needed for negative indices)
virtual window information, see vw
FALSE to suppress rle-packing
a vector of NA positions (not yet used)
an object of class 'hi' to be printed
an object of class 'hi' to be str'ed
current nesting level in the recursive calls to str
further arguments passed to the next method
Jens Oehlschlägel
Class hi
will represent index data either as a plain positive or negative index vector or as an rle-packed version thereof.
The current implementation switches from plain index positions i
to rle-packed storage of diff(i)
as soon as the compression ratio is 3 or higher.
Note that sequences shorter than 2 must never be packed (could cause C-side crash).
Furthermore hybrid indices are guaranteed to be sorted ascending, which helps ffs
access method avoiding to swap repeatedly over the same memory pages (or file positions).
hi(c(1, 11, 29), c(9, 19, 21), c(1,1,-2))
as.integer(hi(c(1, 11, 29), c(9, 19, 21), c(1,1,-2)))
Run the code above in your browser using DataLab