[Rd] BitSet equivalent? Java code usable?

Joachim Harloff joachim.harloff at joachimharloff.de
Fri Oct 7 19:01:07 CEST 2011

Hi all,

I consider writing a R package on statistics for the sorting method as a hobby. I have written a private Java application that I could use as a basis. Therefore I'd like to ask two questions:

1) logical vectors: Bit storage (small) and capable of bit operations?
The Java application relies on BitSet(s) for efficiency reasons. Arrays of logical values cost far too much memory (in the 2nd level heap etc.) while chunks of BitSets easily fit into the first processor cache. Moreover the Bit operations or, xor, and, andnot, cardinality, clone, flip, equals, intersects are much faster done for BitSets than equivalent functions written for logical arrays. Is there any equivalent for BitSet in R? The vector type "logical" seems to be not equally powerful and I do not know its memory requirements. In BitSets a Bit requires just one Bit, no more.

2) Can Java code be used?
Can I use some Java code for a R package (without translating it first to C. This is not always simple)? Probably this sounds ugly but it would greatly simplify the task for me.

Joachim Harloff

More information about the R-devel mailing list