Re: [R] Output of binary representation

2009-05-17 Thread Gabor Grothendieck
Also note that one can use toupper in place of as.character in which case no other changes are required. On Sun, May 17, 2009 at 5:07 PM, Ted Harding wrote: > Thanks, Jim. While that is still in hex, I find I can get the binary > represntation using Gabor's gsubfn() function, provided the A-F isw

Re: [R] Output of binary representation

2009-05-17 Thread Ted Harding
Thanks, Jim. While that is still in hex, I find I can get the binary represntation using Gabor's gsubfn() function, provided the A-F isw changed to a-f in setting up his 'binary.digits', and the output is explicitly cast to character: gsubfn("[0-9a-f]", binary.digits, as.character(writeBin(

Re: [R] Output of binary representation

2009-05-17 Thread Ted Harding
Many thankis, Gabor! That looks both interesting and powerful. Indeed, it seems to implement with one stroke what I had been thinking of implementing piecemeal. Best wishes, Ted. On 17-May-09 17:48:00, Gabor Grothendieck wrote: > gsubfn of the gsubfn package is like gsub but can take a function, >

Re: [R] Output of binary representation

2009-05-17 Thread jim holtman
Are you looking for how the floating point is represented in the IEEE-754 format? If so, you can use writeBin: > writeBin(pi,raw(),endian='big') [1] 40 09 21 fb 54 44 2d 18 On Sun, May 17, 2009 at 1:23 PM, Ted Harding wrote: > I am interested in studying the binary representation of numerics >

Re: [R] Output of binary representation

2009-05-17 Thread Gabor Grothendieck
gsubfn of the gsubfn package is like gsub but can take a function, list or proto object as the replacement instead of a character string and with a list it can be used to readily turn hex to binary: > library(gsubfn) > binary.digits <- + list("0"= "", "1"= "0001", "2"= "0010", "3"= "0011", +