I have a large correlation matrix that I'm trying to convert to a list of
every connection (edge) between every two nodes with its accompanying
correlation value (for Cytoscape). I figured out how to do this and to
remove the connections that nodes have to themselves but I can't figure out
how to get rid of the duplicate pairs (e.g. the edge b-a is a duplicate of
a-b).



NodesRow<-rep(c("a","b","c"),each=3)

NodesCol<-rep(c("a","b","c"),times=3)

Corr<-c(1,.8,.4,.8,1,.3,.4,.3,1)

data<-data.frame(NodesRow,NodesCol,Corr)

# above is what my node and edge dataframe looks like

data2<-subset(data,data[,1]!=data[,2])

# above is how I clear out connections nodes have to themselves


Thanks for any clues of a better way to do this!


Matt



Matthew DiLeo, Ph.D.
Postdoctoral Associate
Boyce Thompson Institute for Plant Research
Robert W. Holley Center, Tower Road, Ithaca

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to