mask | R Documentation |
Create a pattern matrix for simil()
or dist()
to enable masked similarity computation.
If the matrix is passed to the function, it computes similarity scores only for cells with TRUE
.
mask(x, y = NULL)
x |
a numeric or character vector matched against each other. |
y |
a numeric or character vector matched against |
a sparse logical matrix with TRUE
for matched pairs.
mt1 <- Matrix::rsparsematrix(100, 6, 1.0)
colnames(mt1) <- c("a", "a", "d", "d", "e", "e")
mt2 <- Matrix::rsparsematrix(100, 5, 1.0)
colnames(mt2) <- c("a", "b", "c", "d", "e")
(msk <- mask(colnames(mt1), colnames(mt2)))
simil(mt1, mt2, margin = 2, mask = msk, drop0 = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.