I am trying to figure out how to use graph.adjacency to create a graph using a correlation matrix (values -1 to 1), but only having the most strongly correlated edges included in the graph file, ie <-.8 or >.8
Here is the code that successfully gives me the network with the full data set:
corrdata<-read.csv("spearmancorr.csv",header=FALSE)
cor_mat<-as.matrix(corrdata)
diag(cor_mat)<-0
graph<-graph.adjacency(cor_mat,weighted=TRUE,mode="lower")
I tried using delete.edges to reduce the network to at least >.8 to test it out, but the resulting file still shows edge weights below 0.8
graph.copy <- delete.edges(graph, which(E(graph)$weight !<0.8)-1)
write.graph(graph.copy, file="gsig80.graphml", format="graphml")
Any advice on how to get the graph file I want?