cm.colors bug (PR#244)

About this list Date view Thread view Subject view Author view Other groups

Subject: cm.colors bug (PR#244)
david_m_potter@groton.pfizer.com
Date: Tue 10 Aug 1999 - 01:47:57 EST


Message-Id: <199908091547.RAA16601@pubhealth.ku.dk>

Full_Name: David M. Potter
Version: 0.64.1
OS: solaris 2.6
Submission from: (NULL) (12.18.36.220)

cm.colors() returns an extra element "1":

> cm.colors(10)
                                                                               

"#7FFFFF" "#99FFFF" "#B2FFFF" "#CCFFFF" "#E5FFFF" "#FFE5FF" "#FFCCFF" "#FFB2FF"

                            v
"#FF99FF" "#FF7FFF" "1"
>

Why I think it happens

The function has an unnecessary right parentheses
immediately preceding ", v=1" which causes the "v=1" to
be added to the vector rather than being interpreted as an
argument to hsv().

> cm.colors
function (n)
{
    k <- n%/%2
    if (2 * k == n) {
        c(hsv(h = 6/12, s = seq(0.5, 0, length = k + 1)[-k -
            1], v = 1), hsv(h = 10/12, s = seq(0, 0.5, length = n -
            k + 1)[-1]), v = 1)
    }
    else {
        c(hsv(h = 6/12, s = seq(0.5, 0, length = k + 1), v = 1),
            hsv(h = 10/12, s = seq(0, 0.5, length = n - k)[-1]),
            v = 1)
    }
}
>

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b25 : Tue 04 Jan 2000 - 14:16:07 EST