jaccardMatrix {locStra} | R Documentation |
C++ implementation to compute the Jaccard similarity matrix for a (sparse) input matrix.
Description
C++ implementation to compute the Jaccard similarity matrix for a (sparse) input matrix.
Usage
jaccardMatrix(m, useCpp = TRUE, sparse = TRUE)
Arguments
m |
A (sparse) matrix for which the Jaccard similarity matrix is sought. The input matrix is assumed to be oriented to contain the data for one individual per column. |
useCpp |
Flag to switch between R or C++ implementations. Default is |
sparse |
Flag to switch between purpose-built dense or sparse implementations. Default is |
Value
The Jaccard matrix of m
.
References
Dmitry Prokopenko, Julian Hecker, Edwin Silverman, Marcello Pagano, Markus Noethen, Christian Dina, Christoph Lange and Heide Fier (2016). Utilizing the Jaccard index to reveal population stratification in sequencing data: a simulation study and an application to the 1000 Genomes Project. Bioinformatics, 32(9):1366-1372.
Examples
require(locStra)
require(Matrix)
m <- matrix(sample(0:1,15,replace=TRUE),ncol=3)
sparseM <- Matrix(m,sparse=TRUE)
print(jaccardMatrix(sparseM))