[R] Getting variable names from as.matrix

From: David Kaplan <dkaplan_at_education.wisc.edu>
Date: Wed, 30 Apr 2008 15:26:10 -0500


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

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 30 Apr 2008 - 20:39:40 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 30 Apr 2008 - 21:30:42 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive