Re: [R] converting hexadecimal

From: Duncan Murdoch <>
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 mailing list PLEASE do read the posting guide! 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 Please read the posting guide before posting to the list.