Description Usage Arguments Details Value Examples
list2mat converts a list of matrices to a matrix in which each orginal
matrix locates in the diagonal and off-diagonal cells are set to be NA (by
default).
1 |
mats |
the matrices stored in a |
fill |
the value of the off-diagonal cells. The defalut value is
|
This function convertes a original list of matrices to a new matrix in which
each orginal matrix locates in the diagonal and of diagonal cells are set to
be NA (the filler can be set by changing fill. This conversion is
useful, for example, when running an QAP regression with the intention to
find out the coefficients across networks.
a matrix converted from the list of matrices.
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## library(sna)
mat1 <- rgraph(3)
dimnames(mat1) <- list(paste(rep("A", 3), 1:3, sep = ""),
paste(rep("A", 3), 1:3, sep = ""))
mat2 <- rgraph(4)
dimnames(mat2) <- list(paste(rep("B", 4), 1:4, sep = ""),
paste(rep("B", 4), 1:4, sep = ""))
mat3 <- rgraph(2)
dimnames(mat3) <- list(paste(rep("C", 2), 1:2, sep = ""),
paste(rep("C", 2), 1:2, sep = ""))
mats <- list(mat1, mat2, mat3)
list2mat(mats, fill = NA)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.