# [Rd] cluster - clusplot.default (PR#1249)

**kjetilh@umsanet.edu.bo
**
kjetilh@umsanet.edu.bo

*Mon, 7 Jan 2002 19:42:44 +0100 (MET)*

The following code in clusplot.default (package cluster) is in error:
x1 <- cmdscale(x, k = 2, eig = TRUE)
var.dec <- sum(x1$eig)/sum(diag(x1$x))
if (var.dec < 0)
var.dec <- 0
if (var.dec > 1)
var.dec <- 1
x1 <- x1$points
x1 has components with names "points" and "eig", not "x", so
sum(diag(x1$x)) returns 0, the division gives Inf which is later replaced
by 1.
So in the plot it is reported (always) that "These two components explain
100%
of the variability".
Besides, is it reasonable that sum(NULL) returns 0 without at least a
warning?
Another small point about the cluster package: it loads automatically
mva, but that is not mentioned in the Depends field in the description file.
Kjetil Halvorsen
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._