[R] clustering algorithm detail

From: Tim Smith <tim_smith_666_at_yahoo.com>
Date: Thu 20 Oct 2005 - 06:36:19 EST


Hi all,  

I wanted to run the hclust (or any other clustering algorithm) on a distance matrix. I have formed the distance matrix as:  

distmat:  

        a b c d e a 0.00 0.96 1.60 1.60 1.68 b 0.96 0.00 0.96 1.80 2.64

c   1.60    0.96    0.00    0.84    1.80
d   1.60    1.80    0.84    0.00    0.96
e   1.68    2.64    1.80    0.96    0.00
 

Now, I would like to run a clustering algorithm on it. I tried:  

newclust = hclust(distmat)  

and got the following error:  

Error in if (n < 2) stop("Must have n >= 2 objects to cluster") :

        argument is of length zero  

I understand that the documentation says that the matrix ' d: a dissimilarity structure as produced by 'dist''. Does that mean that I need to convert it into a lower triangle matrix? I also tried:  

newclust = hclust(vech(distmat))  

but this gave a similar error. Where am I going wrong?    

Also, will hclust be able to handle 'NA' in the dissimilarity matrix?  

many thanks,    

Tim                     


        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Oct 20 06:43:36 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:46 EST