Try this:

> mycolor <- col2rgb("red"); mycolor
      [,1]
red    255
green    0
blue     0
> colors()[sapply(lapply(colors(), col2rgb), identical, mycolor)]
[1] "red"  "red1"


On Mon, Nov 30, 2009 at 2:25 PM, Jorgy Porgee <jorgy.por...@gmail.com>wrote:

> Hi all, I'm trying to convert a series of rgb codes into a color name.
> What is my easiest option? So far I'm stuck with just converting to
> hex using rgb() and I know R knows a number of colours() but a mapping
> of the two has failed me.
>
> Any help in this regard will be highly appreciated.
>
> Regards,
>
> George
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to