Re: [R] converting hexadecimal

From: Duncan Murdoch <murdoch_at_stats.uwo.ca>
Date: Thu 25 May 2006 - 01:23:39 EST

On 5/24/2006 11:01 AM, Romain Lorrilliere wrote:
> Hi,
>
> do you know, a method to convert an hexadecimal value to the
> corresponding integer value (decimal) ?

as.double (which is called by as.numeric) automatically converts hex to numeric values. You need to make sure the hex strings have a "0x" prefix, e.g.

 > as.numeric("0x0A")
[1] 10

You can use paste() or gsub() to put the prefix on existing strings.

Duncan Murdoch



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 Thu May 25 01:45:52 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 25 May 2006 - 02:10:26 EST.

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