[R] Hex Decimal Convert
John Fox
jfox at mcmaster.ca
Sun Apr 6 22:38:19 CEST 2008
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/
More information about the R-help
mailing list