R: A class for vectors representing asymetric selections

bitwhich {bit} | R Documentation

## A class for vectors representing asymetric selections

### Description

A bitwhich object like the result of `which` and `as.which` does represent integer subscript positions, but bitwhich objects represent some subscripts rather with negative integers, if this needs less space. The extreme cases of selecting all/none subscripts are represented by TRUE/FALSE. This needs less RAM compared to `logical` (and often less than `as.which`). Logical operations are fast if the selection is asymetric (only few or almost all selected).

### Usage

    bitwhich(maxindex, poslength = NULL, x = NULL)

### Arguments

`maxindex` | the length of the vector (sum of all TRUEs and FALSEs)
`poslength` | Only use if x is not NULL: the sum of all TRUEs
`x` | Default NULL or FALSE or unique negative integers or unique positive integers or TRUE

### Details

class 'bitwhich' represents a boolean selection in one of the following ways

- FALSE to select nothing

- TRUE to select everything

- unique positive integers to select those

- unique negative integers to exclude those

### Value

An object of class 'bitwhich' carrying two attributes

`maxindex` | see above
`poslength` | see above

### Author(s)

Jens Oehlschlägel

### See Also

`as.bitwhich`, `as.which`, `bit`

### Examples

     bitwhich(12, x=c(1,3), poslength=2)
     bitwhich(12, x=-c(1,3), poslength=10)

[Package bit version 1.1-15 Index]