I would like to use the igraph library. I have a data.frame with 3 columns which looks like this :

> head(data)
     var1    var2  corr
1 OTU0001 OTU0004 0.804
2 OTU0001 OTU0014 0.644
3 OTU0004 OTU0014 0.664
4 OTU0001 OTU0016 0.730
5 OTU0004 OTU0016 0.674
6 OTU0014 OTU0016 0.655

Is it possible to import it ?

1 Answers

2
captcoma On

Check out the manual: https://igraph.org/r/doc/igraph.pdf

You could use something like:

library(igraph)

data <- data.frame(var1=c("OUT0001","OUT0001","OUT0004","OUT0001","OUT0004","OUT0014"),
                   var2=c("OUT0004","OUT0014","OUT0014","OUT0016","OUT0016","OUT0016"),
                   corr=c(0.804,0.644,0.664,0.730,0.674,0.655))

g <- graph_from_data_frame(data, directed=TRUE)
plot(g)