[R] Convert a List of Distances to a Distance Matrix

From: Charles Willis <willis.charlie_at_gmail.com>
Date: Wed, 12 Mar 2008 20:45:39 -0400


Hello,

Is there an easy function for switching list to matrix. My list is of genetic distances between species pairs:

A A 0

A B .5
A C .25
B C .5

and I want a distance matrix such as:

   A B C
A 0 .5 .25
B .5 0 .5
C .25 .5 0

for use in a mantel test.

Thank you for the help!

cheers,
charlie

-- 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Charles G. Willis Department of Organismic and Evolutionary Biology 22 Divinity Ave Cambridge MA 02139 HP (857) 488-2506 WP (617) 496-3890 cgwillis_at_oeb.harvard.edu http://www.people.fas.harvard.edu/%7Ecgwillis/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[[alternative HTML version deleted]] ______________________________________________ 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 Thu 13 Mar 2008 - 00:50:07 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 Thu 13 Mar 2008 - 03:30:21 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