Re: [R] dec2bin?

From: Tuszynski, Jaroslaw W. <JAROSLAW.W.TUSZYNSKI_at_saic.com>
Date: Tue 04 Oct 2005 - 01:00:15 EST


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@saic.com                     `   \ 



-----Original Message-----
From: r-help-bounces@stat.math.ethz.ch
[mailto:r-help-bounces@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@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

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 Received on Tue Oct 04 01:02:49 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:34 EST