1% Generated by roxygen2: do not edit by hand
2% Please edit documentation in R/bit.R
3\name{bitwhich}
4\alias{bitwhich}
5\title{Create bitwhich vector (skewed boolean)}
6\usage{
7bitwhich(
8  maxindex = 0L,
9  x = NULL,
10  xempty = FALSE,
11  poslength = NULL,
12  is.unsorted = TRUE,
13  has.dup = TRUE
14)
15}
16\arguments{
17\item{maxindex}{length of the vector}
18
19\item{x}{Information about which positions are FALSE or TRUE: either \code{logical()} or \code{TRUE} or \code{FALSE} or a integer vector of positive or of negative subscripts.}
20
21\item{xempty}{what to assume about parameter \code{x} if \code{x=integer(0)}, typically \code{TRUE} or \code{FALSE}.}
22
23\item{poslength}{tuning: \code{poslength} is calculated automatically, you can give \code{poslength} explicitely, in this case it must be correct and \code{x} must be sorted and not have duplicates.}
24
25\item{is.unsorted}{tuning: FALSE implies that \code{x} is already sorted and sorting is skipped}
26
27\item{has.dup}{tuning: FALSE implies that \code{x} has no duplicates}
28}
29\value{
30an object of class 'bitwhich' carrying two attributes
31\describe{
32  \item{maxindex}{ see above }
33  \item{poslength}{ see above }
34}
35}
36\description{
37A bitwhich object represents a boolean filter like a \code{\link{bit}} object (NAs are not allowed)
38but uses a sparse representation suitable for very skewed (asymmetric) selections.
39Three extreme cases are represented with logical values, no length via logical(),
40all TRUE with TRUE and all FALSE with FALSE. All other selections are represented with
41positive or negative integers, whatever is shorter.
42This needs less RAM compared to \code{\link{logical}} (and often less than \code{\link{bit}} or \code{\link[=as.which]{which}}).
43Logical operations are fast if the selection is asymetric (only few or almost all selected).
44}
45\examples{
46bitwhich()
47bitwhich(12)
48bitwhich(12, x=TRUE)
49bitwhich(12, x=3)
50bitwhich(12, x=-3)
51bitwhich(12, x=integer())
52bitwhich(12, x=integer(), xempty=TRUE)
53}
54\seealso{
55\code{\link{bitwhich_representation}},  \code{\link{as.bitwhich}}, \code{\link{bit}}
56}
57