matrix_to_edgelist | R Documentation |
Transform a square matrix to an edge-list
matrix_to_edgelist(A, digraph = FALSE, valued = FALSE, loops = FALSE)
A |
A square matrix |
digraph |
Whether the matrix is directed or not |
valued |
Add a third columns with the valued of the relationship |
loops |
Whether the loops are retained or not |
This function transform the matrix into an edgelist
Alejandro Espinosa-Rada
A <- matrix(c(
0, 2, 1,
1, 0, 0,
1, 0, 1
), byrow = TRUE, ncol = 3)
matrix_to_edgelist(A, digraph = TRUE, valued = TRUE, loops = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.