[R] dec2bin?

Tuszynski, Jaroslaw W. JAROSLAW.W.TUSZYNSKI at saic.com
Mon Oct 3 17:00:15 CEST 2005


It is unclear what you are trying to do, but check bin2raw in caTools
package:

>  print(x <- (1:5)*pi)      
[1]  3.141593  6.283185  9.424778 12.566371
[5] 15.707963
>         print(y <- bin2raw(x))
 [1] 18 2d 44 54 fb 21 09 40 18 2d 44 54 fb 21 19
[16] 40 d2 21 33 7f 7c d9 22 40 18 2d 44 54 fb 21
[31] 29 40 5e 38 55 29 7a 6a 2f 40
>         print(z <- raw2bin(y,"double"))
[1]  3.141593  6.283185  9.424778 12.566371
[5] 15.707963 


May be that is what you need.

 Jarek 
====================================================\==== 
 Jarek Tuszynski, PhD.                           o / \ 
 Science Applications International Corporation  <\__,|  
 (703) 676-4192                                   ">  \ 
 Jaroslaw.W.Tuszynski at saic.com                     `   \ 



-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Haiyong Xu
Sent: Saturday, October 01, 2005 4:22 PM
To: Help R
Subject: [R] dec2bin?

Hello,

I just want to ask if there is any function that can convert decimal number
to binary vector.

Thanks a lot.
Haiyong

______________________________________________
R-help at 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




More information about the R-help mailing list