[R] bit set or bit test
jerome at hivnet.ubc.ca
Thu Apr 17 19:11:54 CEST 2003
I'm not sure I understand your message, but see if this example is useful.
ntharray <- rbind(c(1,0,0,1,0),c(0,0,1,0,1))
See also ?binary in package "wle".
# 1 0 0 1 0
# TRUE FALSE FALSE TRUE FALSE
On April 16, 2003 11:45 pm, Mike Sumner wrote:
> 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
> Cheers, Mike.
> R-help at stat.math.ethz.ch mailing list
Jerome Asselin (Jérôme), Statistical Analyst
British Columbia Centre for Excellence in HIV/AIDS
St. Paul's Hospital, 608 - 1081 Burrard Street
Vancouver, British Columbia, CANADA V6Z 1Y6
Email: jerome at hivnet.ubc.ca
Phone: 604 806-9112 Fax: 604 806-9044
More information about the R-help