# Attach supplementary packages
library (igraph)
library (rgexf)
# Adjacency matrix from the binary matrix of significant
# co-occurrences (results of the previous section)
adjm1 < - 1 - as.matrix
- 1 - as.matrix
(res.pa.dist)
diag (adjm1) < - 0
# Adjacency matrix from the "a" distance matrix
adjm2 <
(res$p.a.dist)
adjm2[adjm2 < 0.5] <- 0
diag (adjm2) < - 0
# Adjacency matrix from the Spearman rank correlation matrix
adjm3 < - cor (spe, method = "spearman" )
# Only positive associations (rho >= 0.25)
adjm2[adjm3 < 0.25 ] <- 0
adjm2[adjm3 >= 0.25] <- 1 # binary co - occurrences
diag (adjm3) < - 0
# Species co - occurrence dissimilarities
# (picante package, Hardy 2008)
adjm4 < - species.dist (spe.pa, metric = "jaccard" )
adjm4 < - as.matrix (adjm4)
adjm4[adjm4 < 0.4] <- 0
# Select an adjacency matrix
adjm <- adjm4
summary ( as.vector (adjm))
# Plot histogram of adjacency values
hist (adjm)
# Build graph
go <- graph_from_adjacency_matrix ( adjm, weighted = TRUE,
mode = "undirected")
plot (go)
# Network structure detection: find densely connected subgraphs
# (modules) in a graph
wc <- cluster_optimal (go)
modularity (wc)
mem bership (wc)
plot (wc, go)
)
)
# Detach package rgexf
detach "package:rgexf" unload = TRUE
unloadnamespace "rgexf"
(
(
4.10 Species Assemblages
119
Précédent

- 132/444

Suivant