>>>>> "David" == David Forrest <[EMAIL PROTECTED]>
>>>>>     on Thu, 7 Apr 2005 16:19:33 -0500 (CDT) writes:



....

    David> I think R has the hex to decimal OK, but might be
    David> lacking in the decimal to hex case

    David> zz<-function(x){ x<-as.numeric(sub("#",'0x',x));
    David> c(x%/%256^2, x%/%256%%256, x%%256) }

    >> zz('#0f0e0d')
    David> [1] 15 14 13
    >> zz('#ff0080')
    David> [1] 255 0 128

I think you have overlooked  the  col2rgb() function
which does this (and more).

    David> If you already have the 3 byte triplet in read in as
    David> a binary, the same integer arithmetic does the
    David> extraction.

______________________________________________
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