[R] Create pairwise table from columns?

knussear knussear at mac.com
Sat May 10 02:17:44 CEST 2008


Hi Group

I have a large data set of individual pairwise values (250,000 rows) that I
need to reshape into a pairwise matrix for mantel tests of these values
versus genetic distances.

the data are currently in columns formatted like so
AnimalA, AnimalB, Score
A1, A2, S1
A1, A3, S2
A1, A4, S3
A2, A3, S4
A2, A4, S5
A3, A4, S6
...,....,....


I need the final matrix to be formatted as
     A1    A2    A3    A4
A1  0     S1    S2    S3
A2  S1    0     S4    S5
A3  S2    S4   0      S6
A4  S3    S4   S6     0

are there any functions/packages that will make this easier?

Thanks

Ken
-- 
View this message in context: http://www.nabble.com/Create-pairwise-table-from-columns--tp17158538p17158538.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list