#############################################################################
# EXAMPLE 1: SIA for data.read
#############################################################################
data(data.read)
dat <- data.read
res <- sia.sirt(dat , significance=.85 )
#*** plot results with igraph package
library(igraph)
plot( res$igraph.obj ) # , vertex.shape="rectangle" , vertex.size=30 )
#*** plot results with qgraph package
library(qgraph)
qgraph::qgraph( res$adj.matrix )
#*** plot results with Rgraphviz package
# Rgraphviz can only be obtained from Bioconductor
# If it should be downloaded, select TRUE for the following lines
if (FALSE){
source("http://bioconductor.org/biocLite.R")
biocLite("Rgraphviz")
}
# define graph
grmatrix <- res$graph.matr
res.graph <- new("graphNEL", nodes= res$graph.edges , edgemode="directed")
# add edges
RR <- nrow(grmatrix)
for (rr in 1:RR){
res.graph <- Rgraphviz::addEdge(grmatrix[rr,1], grmatrix[rr,2], res.graph , 1)
}
# define cex sizes and shapes
V <- length(res$graph.edges)
size2 <- rep(16,V)
shape2 <- rep("rectangle" , V )
names(shape2) <- names(size2) <- res$graph.edges
# plot graph
Rgraphviz::plot( res.graph, nodeAttrs =list("fontsize" = size2 , "shape" = shape2) )
Run the code above in your browser using DataLab