bitwhich {bit} | R Documentation |
Create bitwhich vector (skewed boolean)
Description
A bitwhich object represents a boolean filter like a bit()
object (NAs are not
allowed) but uses a sparse representation suitable for very skewed (asymmetric)
selections. Three extreme cases are represented with logical values, no length via
logical()
, all TRUE
with TRUE
and all FALSE
with FALSE
. All other
selections are represented with positive or negative integers, whatever is shorter.
This needs less RAM compared to logical()
(and often less than bit()
or
which()
). Logical operations are fast if the selection is asymmetric
(only few or almost all selected).
Usage
bitwhich(
maxindex = 0L,
x = NULL,
xempty = FALSE,
poslength = NULL,
is.unsorted = TRUE,
has.dup = TRUE
)
Arguments
maxindex |
length of the vector |
x |
Information about which positions are |
xempty |
what to assume about parameter |
poslength |
tuning: |
is.unsorted |
tuning: FALSE implies that |
has.dup |
tuning: FALSE implies that |
Value
an object of class 'bitwhich' carrying two attributes
maxindex: see above
poslength: see above
See Also
bitwhich_representation()
, as.bitwhich()
, bit()
Examples
bitwhich()
bitwhich(12)
bitwhich(12, x=TRUE)
bitwhich(12, x=3)
bitwhich(12, x=-3)
bitwhich(12, x=integer())
bitwhich(12, x=integer(), xempty=TRUE)