Re: [R] clustering algorithm detail

From: Christian Hennig <chrish_at_stats.ucl.ac.uk>
Date: Thu 20 Oct 2005 - 06:53:06 EST

Have you tried as.dist(distmat)?

Christian

On Wed, 19 Oct 2005, Tim Smith wrote:

> 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
>


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 07:17:40 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 19:07:22 EST