[Rd] cmdscale: labels missing (PR#1220)

kleiweg@let.rug.nl kleiweg@let.rug.nl
Tue, 18 Dec 2001 11:11:11 +0100 (MET)


The function cmdscale tries to copy names from the source to the
result. This only works if the source is a matrix.

If m is a matrix with labels (rownames) and d is an object of
class "dist" with labels, this works:

    cmdscale(m)

...but with this, there are no labels in the results:

    cmdscale(d)

However, this works:

    cmdscale(as.matrix(d))

My suggestion is to change, in the function cmdscale, this line:

    dimnames(points) <- list(dimnames(d)[[1]], NULL)

...into this:

    if (is.null (row.names(points) <- names(d)))
        dimnames(points) <- list(dimnames(d)[[1]], NULL)


By the way, I think it would be nice if the functions isoMDS and
sammon also copied the labels from the input to the result. At
the moment, I'm using wrapper function for all three functions
to preserve the labels.

--please do not edit the information below--

Version:
 platform = i586-pc-linux-gnu
 arch = i586
 os = linux-gnu
 system = i586, linux-gnu
 status =
 major = 1
 minor = 3.1
 year = 2001
 month = 08
 day = 31
 language = R

Search Path:
 .GlobalEnv, package:MASS, package:mva, package:iLeven, package:ctest, Autoloads, package:base


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