Rで簡単なネットワークを描かせたい

sudo apt-get install graphviz graphviz-dev

R
source("http://bioconductor.org/biocLite.R")
biocLite(c("graph", "RBGL", "Rgraphviz"))

library(graph)
library(Rgraphviz)

myNodes <- c("s", "p", "q", "r")
s = list(edges = c("p", "q"))
p = list(edges = c("p", "r"))
q = list(edges = c("p", "r"))
r = list(edges = ("s"))
myEdges <- list(s = s, p = p, q = q, r = r)
myEdges

#myEdges <- list(s = list(edges = c("p", "q")), p = list(edges = c("p", "r")), q = list(edges = c("p", "r")), r = list(edges = c("s")))

g <- new("graphNEL", nodes = myNodes, edgeL = myEdges, edgemode = "directed")
g
plot(g)

よし! うまくいった!

昔、windowsの環境で、R上でGraphvizが動かず四苦八苦したが、今回はubuntuがよく裏で動いてくれてるみたい笑