File: bitwhich.Rd

package info (click to toggle)
r-cran-bit 4.6.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,000 kB
  • sloc: ansic: 5,145; sh: 13; makefile: 6
file content (62 lines) | stat: -rw-r--r-- 2,171 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bit.R
\name{bitwhich}
\alias{bitwhich}
\title{Create bitwhich vector (skewed boolean)}
\usage{
bitwhich(
  maxindex = 0L,
  x = NULL,
  xempty = FALSE,
  poslength = NULL,
  is.unsorted = TRUE,
  has.dup = TRUE
)
}
\arguments{
\item{maxindex}{length of the vector}

\item{x}{Information about which positions are \code{FALSE} or \code{TRUE}: either \code{logical()} or
\code{TRUE} or \code{FALSE} or a integer vector of positive or of negative subscripts.}

\item{xempty}{what to assume about parameter \code{x} if \code{x=integer(0)}, typically \code{TRUE}
or \code{FALSE}.}

\item{poslength}{tuning: \code{poslength} is calculated automatically, you can give
\code{poslength} explicitly, in this case it must be correct and \code{x} must be sorted and
not have duplicates.}

\item{is.unsorted}{tuning: FALSE implies that \code{x} is already sorted and sorting
is skipped}

\item{has.dup}{tuning: FALSE implies that \code{x} has no duplicates}
}
\value{
an object of class 'bitwhich' carrying two attributes
\itemize{
\item maxindex: see above
\item poslength: see above
}
}
\description{
A bitwhich object represents a boolean filter like a \code{\link[=bit]{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
\code{logical()}, all \code{TRUE} with \code{TRUE} and all \code{FALSE} with \code{FALSE}. All other
selections are represented with positive or negative integers, whatever is shorter.
This needs less RAM compared to \code{\link[=logical]{logical()}} (and often less than \code{\link[=bit]{bit()}} or
\code{\link[=as.which]{which()}}). Logical operations are fast if the selection is asymmetric
(only few or almost all selected).
}
\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)
}
\seealso{
\code{\link[=bitwhich_representation]{bitwhich_representation()}},  \code{\link[=as.bitwhich]{as.bitwhich()}}, \code{\link[=bit]{bit()}}
}