[R] Converting decimal to binary in R

Earl F Glynn efglynn at gmail.com
Mon Dec 16 15:36:28 CET 2013


水静流深 wrote:
> i  have write a function to convert decimal number into binary number in R.
>
> dectobin can get right result ,it is so long ,is there a  build-in function to do ?

Try the R.utils package:

 > library(R.utils)

 > intToBin(12)
[1] "1100"
 > intToBin(255)
[1] "11111111"
 > intToBin(65535)
[1] "1111111111111111"
 > intToBin(65536)
[1] "10000000000000000"

Earl F Glynn
Principal Programmer/Analyst
Center for Health Insights • University of Missouri – Kansas City



More information about the R-help mailing list