0
我有以下数据集(DAT):在R中执行Mantel测试时如何解决“零距离”错误?
popfst long lat
0.9 77.416667 23.25000
0.2 -6.116667 36.70000
0.3 -77.028333 -12.04333
0.3 -86.929000 40.42400
我希望在以下的数据执行Mantel检验。对于我所中的R
location.distance <- dist(cbind(dat$long,dat$lat))
genetic.distance <- dist(dat$popfst)
as.matrix(location.distance)[1:4,1:4]
as.matrix(genetic.distance)[1:4,1:4]
mantel.rtest(location.distance, genetic.distance, nrepet = 9999)
写了下面的代码。然而,当我运行的最后一行出现以下错误
Error in if (any(distmat < tol)) warning("Zero distance(s)") :
missing value where TRUE/FALSE needed
我不知道如何来纠正这个错误。我没有看到other who have尝试过这种类似的错误。有什么建议么?