Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.A41.4.61b.0504071034420.346778@homer12.u.washington.edu>
Date: 2005-04-07T17:40:36Z
From: Thomas Lumley
Subject: hex format
In-Reply-To: <d33onu$v42$1@sea.gmane.org>

On Thu, 7 Apr 2005, Earl F. Glynn wrote:
> 1) While generally I'd agree with your statement, manipulating colors is one
> place the ability to convert to/from hex would be quite nice.
>
>> rgb(1,0,0.5)
> [1] "#FF0080"
>
> rgb returns a hex string and then R makes manipulating this string somewhat
> difficult.  One might want to use such color values to convert to a
> different color space, perform some sort of manipulation in that other color
> space, and then convert back to rgb.

The convertColor function in R 2.1.0 provides colorspace conversion, 
including "hex".

>
> 5) Does R have a hex consistency problem?  The color values start with a "#"
> for hex, but the as.numeric("#FF0080") isn't allowed?

#ff0080 isn't a number, it's a colour (or perhaps a color). If it were 
converted to numeric form it would be a vector of three numbers, and which 
three numbers would depend on the coordinate system used for colour space. 
For example, R already provides both hsv() and rgb() to create colours 
from vectors of three numbers, but the correspondence is different in each 
case.


 	-thomas