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

**Prof Brian Ripley
**
ripley@stats.ox.ac.uk

*Mon, 7 Jan 2002 19:38:59 +0000 (GMT)*

On Mon, 7 Jan 2002 kjetilh@umsanet.edu.bo wrote:
>*
*>*
*>*
*>*
*>*
*>* 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?
*
Yes: an empty sum is zero in mathematics. S code relies on such things.
>* Another small point about the cluster package: it loads automatically
*>* mva, but that is not mentioned in the Depends field in the description file.
*
It depends on base too, but that's not mentioned. The convention is to
only include packages that are not in the standard tar bundle.
We can (and do) move things around between those, and indeed have talked
about some major reorganization of them (back as far DSC99, in fact).
You'll find most packages follow that convention: MASS uses almost all the
standard packages somewhere.
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._