[R] bit set or bit test

Mike Sumner mike_rphd at yahoo.com
Thu Apr 17 08:45:12 CEST 2003


Hello, does R have functions for setting and testing
bit values?

I want to conserve memory for storing presence/absence
data for large multiple arrays within a single array,
using element values like

present[x,y] <- ntharray[x,y]*(2^n)

where presence is 1, non-presence is 0 and n is the
nth array

e.g.  1*(2^0) + 0*(2^1) + 0*(2^2) + 1*(2^3) + 0(2^4) 

for storing the value 9 for presence in the first and
fourth array, and absence in the second, third and
fifth arrays.  

Does R already have something to handle stuff like
this?

Cheers, Mike.



More information about the R-help mailing list