kat = read.table("Psychol.txt",dec=",",header = T) kat head(kat) d<-dist(kat,method="binary") cl<-hclust(d) plot(cl,labels=kat$Jmeno,main="Shluky psychologů") # ,names=kat$Jmeno sc<-cmdscale(d,eig=TRUE, k=2) # k is the number of dim sc # view results x<-sc$points[,1] y<-sc$points[,2] plot(x, y, xlab="Dim 1", ylab="Dim 2", main="MDS", type="n") text(x, y, labels = kat$Jmeno, cex=.7) names(kat) # Nonmetric MDS # N rows (objects) x p columns (variables) # each row identified by a unique row name library(MASS) d <- dist(mydata) # euclidean distances between the rows fit <- isoMDS(d, k=2) # k is the number of dim fit # view results # plot solution x <- fit$points[,1] y <- fit$points[,2] plot(x, y, xlab="Coordinate 1", ylab="Coordinate 2", main="Nonmetric MDS", type="n") text(x, y, labels = row.names(kat), cex=.7)