mat_to_net {bioregion} | R Documentation |
Create a data.frame from a contingency table
Description
This function creates a two- or three-columns data.frame
where
each row represents the interaction between two nodes (site and species for
example) and an optional third column indicating the weight of the
interaction (if weight = TRUE
) from a contingency table (sites as
rows and species as columns for example).
Usage
mat_to_net(
mat,
weight = FALSE,
remove_zeroes = TRUE,
include_diag = TRUE,
include_lower = TRUE
)
Arguments
mat |
a contingency table (i.e. |
weight |
a |
remove_zeroes |
a |
include_diag |
a |
include_lower |
a |
Value
A data.frame
where each row represents the interaction
between two nodes and an optional third column indicating the weight of the
interaction.
Author(s)
Maxime Lenormand (maxime.lenormand@inrae.fr), Pierre Denelle (pierre.denelle@gmail.com) and Boris Leroy (leroy.boris@gmail.com)
See Also
Examples
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)