MDS {iL04} | R Documentation |
Call the function cmdscale
and preserve labels.
As of R version 1.5.0 you don't need this function. You can call
cmdscale
directly, and labels will be preserved.
MDS(dif, dim)
dif |
an object of class dist , with labels stored in the
attribute Labels . |
dim |
the dimension of the space which the data are to be represented in. |
A matrix whose rows give the coordinates of each vector, with labels stored as rownames.
RuG/L04 - software for dialectometrics and cartography: http://www.let.rug.nl/~kleiweg/L04/
data(PA) vec <- MDS(PA, 2) plot(vec, type = "n", xlab = "", ylab = "") text(vec, rownames(vec), cex = 0.5) vec8 <- MDS(PA, 8) d2 <- dist(vec) d8 <- dist(vec8) cor(PA, d2) cor(PA, d8) plot(range(PA), range(d2, d8), type = "n", xlab = "PA", ylab = "dist( cmdscale( PA ) )") points(PA, d2, pch = 20, cex = 0.5, col = "black") points(PA, d8, pch = 20, cex = 0.5, col = "blue") legend(min(PA), max(d2, d8), c("dim = 2", "dim = 8"), fill = c("black", "blue"))