开发者

Hierarchial clustering in R

I am getting the following error when I use hclust function? How can I solve this problem? I am using windows 7 and 2.12.3 version of R.

n_seq <- 250                                                   
mat <- matrix(NA, ncol=n_seq, nrow=n_seq)    
for (idx in 1:n_seq) 
{mat[idx,idx] <- 0.0}         
for(idx in 1:(n_seq-1) )
{intemp <- read.xls("C:// clustal.xls", sheet = idx ); 
mat[(1+idx):n_seq,idx] <开发者_如何学运维;- intemp[1:(n_seq-idx), 11]}

fit <- hclust(as.dist(mat), method="single")

Error in hclust(as.dist(mat), method = "single") : 
NA/NaN/Inf in foreign function call (arg 11)

Please help me to solve this problem.


This error message arises because the distance matrix as.dist(mat) has a bad value (NA, NaN or Inf) in it. If you look in the code of hclust, the 11th argument to the foreign function call (i.e. by compiled code) is the values of the distance matrix, and this is what R is complaining about. By default, NA, NaN or Inf are not accepted by foreign function calls. See ?.Fortran for more info.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜