[R] Getting variable names from as.matrix
    David Kaplan 
    dkaplan at education.wisc.edu
       
    Wed Apr 30 22:26:10 CEST 2008
    
    
  
Hi all,
I'm running a multidimensional scaling model on data that are first 
transformed into a similarity matrix using the program daisy in the 
cluster package.  If I already provide the similarity matrix, the 
plotting routine will give me the variable names on the plot itself.  
But, it seems that when I use the daisy program to create the similarity 
matrix, I can't get the program to give me variable names on the plot.  
Here is the input
## Sammon's MDS
country.demog <- read.csv("~/Desktop/country.demog.csv")
## daisy requires loading the cluster package.  It will calculate 
standardized Eculidean distances
country.demog.dist <- daisy(country.demog,metric="euclidean",stand=TRUE)
## The following line calculates the ordinal MDS
country.mds <- sammon(dist(country.demog.dist), k=2)
## The following lines create the MDS map using country names.  It also 
places horizontal and vertical lines for reference.
plot(country.mds$points,type="n")
text(country.mds$points, labels = as.character(country.demog$country))
abline(h=0)
abline(v=0)
Thanks for any advice,
David
-- 
===============================================================
David Kaplan, Ph.D.
Professor
Department of Educational Psychology
University of Wisconsin - Madison
Educational Sciences, Room, 1061
1025 W. Johnson Street
Madison, WI 53706
email: dkaplan at education dot wisc dot edu
homepage:
http://www.education.wisc.edu/edpsych/facstaff/kaplan/kaplan.htm
Phone: 608-262-0836
    
    
More information about the R-help
mailing list