I have matrix that through the interpretation as a network shall give me an edgelist with the matrix' values as weights.
M4 <- matrix(rpois(36,5),nrow=6) #randomly googled that to have sample data
Mg <- graph.adjacency(M4) # make matrix into graph
Mw <- get.data.frame(Mg) # 1st try
Mw2 <- cbind( get.edgelist(Mg) , round( E(Mg)$weight, 3 )) # second try
You'll probably see that Mw using get.data.frame is giving me an edgelist, but without the edge weight. There is probably an attribute, which I can't find or understand.
Mw2 using this solution returns:
Error in round(E(Mg)$weight, 3) : non-numeric argument to mathematical function.
How to work around that? Leaves me puzzled.