[R] Please help -- Converting a 2D matrix to 3 columns for graphical representation

kparamas kparamas at asu.edu
Fri Jan 28 05:13:33 CET 2011


Hi,

I am trying to convert a 2D correlation matrix to 3 columns for graphical
representation:

rdata = replicate(100, rnorm(15)) #construct a 2D matrix
c1 = cor(rdata) #outputs a correlation matrix

Now I want to convert the 2D c1 to 
(row#, col#, correlation)

1 1 cor1
1 2 cor2
1 3 cor3
...
2 1 cor..

Is there a way to do this?
The main reason I am doing this is to find a correlation based graph for
values >= 0.85 using,

corm <- corm[abs(corm[,3]) >= 0.86, ]
library(network); library(sna)
net <- network(corm, directed = F)

cd <- component.dist(net)
delete.vertices(net, which(cd$csize[cd$membership] == 1))
plot(net)

Are there any better ways to plot the 2D correlation matrix for correlations
>= 0.85
Please let me know.

-- 
View this message in context: http://r.789695.n4.nabble.com/Please-help-Converting-a-2D-matrix-to-3-columns-for-graphical-representation-tp3243688p3243688.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list