mat_to_net | R Documentation |
This function generates a two- or three-column data.frame
, where
each row represents the interaction between two nodes (e.g., site and species)
and an optional third column indicates the weight of the interaction
(if weight = TRUE
). The input is a contingency table, with rows
representing one set of entities (e.g., site) and columns representing
another set (e.g., species).
mat_to_net(
mat,
weight = FALSE,
remove_zeroes = TRUE,
include_diag = TRUE,
include_lower = TRUE
)
mat |
A contingency table (i.e., a |
weight |
A |
remove_zeroes |
A |
include_diag |
A |
include_lower |
A |
A data.frame
where each row represents the interaction
between two nodes. If weight = TRUE
, the data.frame
includes a third
column representing the weight of each interaction.
Maxime Lenormand (maxime.lenormand@inrae.fr)
Pierre Denelle (pierre.denelle@gmail.com)
Boris Leroy (leroy.boris@gmail.com)
For more details illustrated with a practical example, see the vignette: https://biorgeo.github.io/bioregion/articles/a2_matrix_and_network_formats.html.
Associated functions: net_to_mat
mat <- matrix(sample(1000, 50), 5, 10)
rownames(mat) <- paste0("Site", 1:5)
colnames(mat) <- paste0("Species", 1:10)
net <- mat_to_net(mat, weight = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.