cm.colors bug (PR#244)

david_m_potter@groton.pfizer.com david_m_potter@groton.pfizer.com
Mon, 9 Aug 1999 17:47:57 +0200 (MET DST)


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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._