[英]How to use R to compute Tanimoto/Jacquard Score as distance matrix
I would like to calculate the distance matrix of the rows in an array in R using Tanimoto/Jacquard Score as distance matrix. 我想用Tanimoto / Jacquard Score作为距离矩阵来计算R中数组中行的距离矩阵。
Is it possible to be done? 有可能吗? If yes, could you mind to teach me how to do it? 如果是的话,你能介意教我怎么做吗?
vegan
package has a vegdist
function that can calculate, among other things, the Jaccard index. vegan
包有一个vegdist
函数,可以计算Jaccard指数等。 Assuming that's what you're after. 假设这就是你所追求的。 It's use is pretty straightforward. 它的使用非常简单。
library(vegan)
data(varespec)
vare.dist <- vegdist(varespec, method = "jaccard")
Other available methods are 其他可用的方法是
method Dissimilarity index, partial match to "manhattan", "euclidean",
"canberra", "bray", "kulczynski", "jaccard", "gower", "altGower", "morisita",
"horn", "mountford", "raup" , "binomial" or "chao"
I think you're going to have a lot more luck searching for "Jaccard" rather than "Jacquard". 我认为你会有更多的运气寻找“Jaccard”而不是“Jacquard”。
install.packages("sos")
) 安装'sos'包( install.packages("sos")
) library(sos); findFn("tanimoto jaccard")
). 使用这些字符串搜索函数( library(sos); findFn("tanimoto jaccard")
)。 install.packages("ade4"); library("ade4"); ?dist.binary
) 通过结果install.packages("ade4"); library("ade4"); ?dist.binary
合适的东西(在我看来, 这可能是你最好的选择; install.packages("ade4"); library("ade4"); ?dist.binary
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.