powered by
fast %in% for integers
%in%
bit_in(x, table, retFUN = as.bit)
a boolean vector coerced to retFUN
retFUN
an integer vector of values to be looked-up
an integer vector used as lookup-table
a function that coerces bit and logical vectors
bit
logical
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%
x
table
bit_in(1:2, 2:3) bit_in(1:2, 2:3, retFUN=as.logical)
Run the code above in your browser using DataLab