Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

bit_in

bit %in%


Description

fast %in% for integers

Usage

bit_in(x, table, retFUN = as.bit)

Arguments

x

an integer vector of values to be looked-up

table

an integer vector used as lookup-table

retFUN

a function that coerces bit and logical vectors

Details

determines the range of the integers and checks if the density justifies use of a bit vector; if yes, maps x or table – whatever is smaller – into a bit vector and searches the other of table or x in the it vector; if no, falls back to %in%

Value

a boolean vector coerced to retFUN

See Also

Examples

bit_in(1:2, 2:3)
bit_in(1:2, 2:3, retFUN=as.logical)

bit

Classes and Methods for Fast Memory-Efficient Boolean Selections

v4.0.4
GPL-2 | GPL-3
Authors
Jens Oehlschlägel [aut, cre], Brian Ripley [ctb]
Initial release
2020-08-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.