[R] Matrix operations please help

From: Srinivas Iyyer <srini_iyyer_bio_at_yahoo.com>
Date: Mon 31 Oct 2005 - 17:56:39 EST


Dear Group,

I have a matrix (157 X 157 ) with correlation values. I want to convert the unique elements into a long list so that I can add an extra variable and plot them.

Example:

      A B C D

alfa 1 0.3 0.8 -0.3

beta 0.2 1 -0.3 0.4

echo 0.9 -0.3 1 0.5

tang -0.5 0.5 0.4 1

I want to convert into this form:

alfa A 1
alfa B 0.3
alfa C 0.8
alfa D -0.3
beta A 0.2
beta B 1
beta C -0.3
beta D 0.4
.......

and so on.

I will add another variable afterwards:
var1 var2 corr var3
alfa A 1 grp1
alfa B 0.3 grp1
alfa C 0.8 grp2
alfa D -0.3 grp3
beta A 0.2 grp3
beta B 1 grp2
beta C -0.3 grp1
beta D 0.4 grp2
........ and so on....

I am sure there should be a way.. but I am completely clueless..
Can any one help me please.

thanks
srini



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Oct 31 18:18:42 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:53 EST