Description Usage Arguments Value Author(s) Examples
This function uniforms the row number of two similarity matrices according to each row names.
1 | uniform(matrix1, matrix2)
|
matrix1 |
Similarity matrix. |
matrix2 |
Similarity matrix. |
List of two uniformed similarity matrices.
Masaaki TAKADA
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## The function is currently defined as
function (matrix1, matrix2)
{
words <- unique(rbind(matrix(rownames(matrix1)), matrix(rownames(matrix2))))
words <- words[order(words)]
exMatrix1 <- matrix(0, nrow = length(words), ncol = ncol(matrix1))
exMatrix2 <- matrix(0, nrow = length(words), ncol = ncol(matrix2))
rownames(exMatrix1) <- words
rownames(exMatrix2) <- words
colnames(exMatrix1) <- colnames(matrix1)
colnames(exMatrix2) <- colnames(matrix2)
for (word in rownames(matrix1)) {
exMatrix1[word, ] <- matrix1[word, ]
}
for (word in rownames(matrix2)) {
exMatrix2[word, ] <- matrix2[word, ]
}
return(list(exMatrix1, exMatrix2))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.