[R] hex format

Duncan Murdoch murdoch at stats.uwo.ca
Thu Apr 7 17:40:09 CEST 2005


Earl F. Glynn wrote:
> "Prof Brian Ripley" <ripley at stats.ox.ac.uk> wrote in message
> news:Pine.LNX.4.61.0504071442200.25401 at gannet.stats...
> 
>>On Thu, 7 Apr 2005, Steve Vejcik wrote:
>>
>>>Has anyone used hex notation within R to represents integers?
> 
> 
>> Short answer: yes.
>>
>>
>>>as.numeric("0x1AF0")
>>
>>[1] 6896
>>
>>(which BTW is system-dependent, but one person used it as you asked).
> 
> 
> I see this works fine with R 2.0.0 on a Linux platform, but doesn't work at
> all under R 2.0.1 on Windows.
> 
> 
>>as.numeric("0x1AF0")
> 
> [1] NA
> Warning message:
> NAs introduced by coercion
> 
> Seems to me the conversion from hex to decimal should be system independent
> (and makes working with colors much more convenient).  Why isn't this system
> independent now?

Presumably because nobody thought it was important enough to make it so. 
  R isn't a low level system programming language, so why should it 
treat hex specially?

Duncan Murdoch




More information about the R-help mailing list