s-news
[Top] [All Lists]

Problem with legend

To: s-news@wubios.wustl.edu
Subject: Problem with legend
From: "Marc R. Feldesman" <feldesmanm@pdx.edu>
Date: Fri, 22 Dec 2000 13:13:27 -0800
I've been working on some code to put ellipses over a bivariate scatter of canonical variates. The following section of code works fine in R (1.2.0) but fails in SPlus 2000. I've traced the problem to something in the call to legend, but the error message does not make any sense to me.

The error seems to be in the "legend" argument of the call to "legend".

leg.text is defined earlier as:

leg.text<-c("Pan", "Gorilla", "Pongo", "Homo")

The error is:

"cannot convert real to character". I can't decode what SP2K is objecting to, but for some reason it thinks something in the "legend" argument needs to be converted to real.

I'd appreciate any pointers to the error. (Again, this code runs without error in R 1.2.0).

Thanks.

=====================================

.
.....  (other stuff in function snipped)

for(g in levels(G)) {
        kk <- match(g, levels(G)) + 1
        points(CV1[G == g], CV2[G == g], col = kk, pch =
                        kk)
#stops after first call to legend
        legend(par("usr")[1], par("usr")[4] + kk/length(
                        leg.text), leg.text[kk - 1], col = kk, cex
= 0.75, pch = kk, bty = "n", par("xpd"=TRUE)) ellipse(u = gmeans[g, ], S = gvcv[[g]], k = kcrit[ g], col = kk)
}


Dr. Marc R. Feldesman
email:  feldesmanm@pdx.edu
email:  feldesman@attglobal.net
fax:    503-725-3905

"Don't know where I'm going.
Don't like where I've been.
There may be no exit.
But hell, I'm going in."  Jimmy Buffett

Powered by Superchoerus - the 700 MHz Coppermine Box


<Prev in Thread] Current Thread [Next in Thread>
  • Problem with legend, Marc R. Feldesman <=