Hello,
we need to convert a logical vector to a (decimal) integer. Example:

a=c(TRUE, FALSE, TRUE) (binary number 101)

the function we are looking for should return

dec2bin(a)=5

Is there a package for such a function or is it even implemented in the 
base package? We found the hexmode and octmode command, but not a 
binmode. We know how to program it ourselves however we are looking for 
a computationally efficient algorithm.

Martin and Stefan

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to