adj2ig: Create an 'igraph' object from weighted adjacency matrix

Description Usage Arguments Value Examples

View source: R/post_functions.R

Description

Create an igraph object from weighted adjacency matrix

Usage

1
adj2ig(w.adj, v.col = NULL, e.col = NULL)

Arguments

w.adj

The weighted adjacency matrix to be converted to an igraph object

v.col

The vertex colours. Numeric vector of length equal to number of taxa in network.

e.col

The edge colours. Numeric vector of length equal to number of taxa in network. If NULL, then colour green/red based on positive/negative weights.

Value

An object of class igraph corresponding to the provided adjacency matrix

Examples

1
2
3
4
5
6
7
8
9
library(mdine)
data(crohns)

X <- model.matrix(~disease, data=crohns$covars)
md.fit <- mdine(Y=crohns$otu.counts, X=X, Z=X[,2], mc.cores=1, iter=100)
adj <- ci2adj(md.fit, weighted = TRUE)

ig0 <- adj2ig(adj$adj0)
igraph::plot.igraph(ig0)

kevinmcgregor/mdine documentation built on April 10, 2021, 4:18 a.m.