Re: [R] Hex Decimal Convert

From: John Fox <jfox_at_mcmaster.ca>
Date: Sun, 06 Apr 2008 16:38:19 -0400

Dear Edwin,

There's a distinction between the way in which a number is stored internally and the way in which it's printed. R is reading the hex numbers correctly but is printing them in decimal. You can assign the class "hexmode" to the vector containing the data and then it will print in hex:

> data <- c(6565, 0x47780439, 0x00000000, 0x00000000, 0)
> data

[1] 6565 1199047737 0 0 0
> class(data) <- "hexmode"
> data

[1] "000019a5" "47780439" "00000000" "00000000" "00000000"

Notice that the whole vector is printed in hex. If you don't want that, then you could put the data into a list with some members of class "hexmode" and others not.

I hope this helps,
 John

On Sun, 6 Apr 2008 20:52:20 +0100
 Edwin Sendjaja <edwin7_at_gmx.net> wrote:
> Hello,
>
> I have a data with hexdecimal. But GNU R convert it to strange
> number. How can
> I get that hexdecimal showing in the R-table?
>
>
>



> My Data-Table:
> Sender_ID Receiver_ID Other_ID
> 6565 0x47780439 0x00000000 0x00000000 0
>
>


> R-Table:
>
> 6565 1199047737 0 0 0
>
>
>
>
> Kind Regards,
>
> Edwin
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sun 06 Apr 2008 - 20:43:00 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 12 Apr 2008 - 05:30:27 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive