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

______________________________________________
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

Reply via email to