【发布时间】:2014-01-02 19:12:49
【问题描述】:
当我运行以下代码时:
library(fossil)
df <- data.frame(long,lat)
dist <- earth.dist(df, dist=F) #calculating distance matrix
library(LPCM)
ms(dist,0.43,scaled=TRUE,iter=100,plotms=1)
我收到一个错误:
Error in if (th[j] < thresh) { : missing value where TRUE/FALSE needed
我已经通过了运行均值偏移聚类所需的每个输入。为什么我会收到此错误?
如何告诉ms输入是距离矩阵而不是数据矩阵?
head(df)
long lat
1 116.3313 39.97575
2 116.3315 39.97562
3 116.3319 39.97550
4 116.3321 39.97545
5 116.3324 39.97550
6 116.3327 39.97548
【问题讨论】:
-
尝试将
na.rm = TRUE作为另一个参数传递给ms。 -
@Scott Ritchie 试过了,不行
标签: r cluster-analysis