Re: [R] convert large integers to hex

2009-05-07 Thread Sundar Dorai-Raj
Thanks for both answers. In the end I decided to use Gabor's bc package. Thanks, --sundar On Thu, May 7, 2009 at 5:10 AM, Gabor Grothendieck wrote: > There is an interface between R and bc -- not on CRAN but available > from its home page here: > http://r-bc.googlecode.com > >> source("http://r

Re: [R] convert large integers to hex

2009-05-07 Thread Gabor Grothendieck
There is an interface between R and bc -- not on CRAN but available from its home page here: http://r-bc.googlecode.com > source("http://r-bc.googlecode.com/svn/trunk/R/bc.R";) > bc("obase = 16; 123456789123456789", retclass = "character") [1] "1B69B4BACD05F15" On Wed, May 6, 2009 at 9:59 PM, ji

Re: [R] convert large integers to hex

2009-05-06 Thread Gabor Grothendieck
rSymPy (http://rsympy.googlecode.com) can do that: > library(rSymPy) Loading required package: rJava > sympy("hex(12345)") [1] "0x3039" > format.hexmode(as.numeric(12345)) [1] "3039" > sympy("hex(6595137340052185552)") [1] "0x5b86a277deb9a1d0L" as can r-bc package (http://r-bc.googlecode.com - no

Re: [R] convert large integers to hex

2009-05-06 Thread jim holtman
You can use the 'bc' command (use Cygwin if on Windows); /cygdrive/c: bc bc 1.06 Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. x=6595137340052185552 obase=16 x 5B86A277DEB9A1D0 You can call this

[R] convert large integers to hex

2009-05-06 Thread Sundar Dorai-Raj
Hi, I'm wondering if someone has solved the problem of converting very large integers to hex. I know about format.hexmode and as.hexmode, but these rely on integers. The numbers I'm working with are overflowing and losing precision. Here's an example: x <- "6595137340052185552" # stored as charac