View source: R/append_matrix.R
append_matrix | R Documentation |
Combines different connectivity matrices by row names and column names by
performing a 2-dimensional full join. Missing edges are filled with 0
(default) or NA
(argument na_to_zero
).
append_matrix(..., na_to_zero = TRUE)
... |
one or several |
na_to_zero |
a |
A connectivity matrix of dimensions n x n
, where n
is the total
number of unique nodes across all provided matrices.
mat1 <- matrix(rep(1, 9), nrow = 3)
colnames(mat1) <- c("A", "B", "C")
rownames(mat1) <- c("A", "B", "C")
mat1
mat2 <- matrix(rep(1, 9), nrow = 3)
colnames(mat2) <- c("D", "E", "F")
rownames(mat2) <- c("D", "E", "F")
mat2
mat3 <- matrix(rep(1, 9), nrow = 3)
colnames(mat3) <- c("F", "G", "H")
rownames(mat3) <- c("F", "G", "H")
mat3
append_matrix(mat1, mat2, mat3)
append_matrix(mat1, mat2, mat3, na_to_zero = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.