mask {proxyC} | R Documentation |
Create a pattern matrix for masking
Description
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
.
Usage
mask(x, y = NULL)
Arguments
x |
a numeric or character vector matched against each other. |
y |
a numeric or character vector matched against |
Value
a sparse logical matrix with TRUE
for matched pairs.
Examples
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)
[Package proxyC version 0.5.2 Index]