[R] hclust doesn't return merge details

Liaw, Andy andy_liaw at merck.com
Mon Nov 3 19:10:09 CET 2003


> From: Arne Neumann [mailto:an980634 at uni-greifswald.de] 
> 
>  Dear R-users,
> 
> I tried to receive the merge details of a clustering by using 
> the summary function of hclust. For illustration I use the 
> Longley data as done by Prof Ripley (Wed 11 Apr 2001) d <- 
> dist(longley.y) 
> d <- d/max(d) 
> hc <- hclust(d, "ave") 
> 
> But instead of getting a matrix for $merge I get:
> >summary(hc)
> 		Length Class  Mode     
> merge       30     -none- numeric  
> height      15     -none- numeric  
> order       16     -none- numeric  
> labels       0     -none- NULL     
> method       1     -none- character
> call         3     -none- call     
> dist.method  1     -none- character
> 
> Am I missing something?

I believe so.

> str(hc)
List of 7
 $ merge      : int [1:15, 1:2] -6 -13 -10 -1 -9 -3 -5 -16 -12 8 ...
 $ height     : num [1:15] 20.1 23.6 27.2 29.2 41.4 ...
 $ order      : int [1:16] 1 2 3 4 16 13 14 12 15 5 ...
 $ labels     : chr [1:16] "1947" "1948" "1949" "1950" ...
 $ method     : chr "average"
 $ call       : language hclust(d = dist(data.matrix(longley)), method =
"ave")
 $ dist.method: chr "euclidean"
 - attr(*, "class")= chr "hclust"

so the "merge" component is a n x 2 matrix, whose mode is "numeric".

Andy


> Arne Neumann
> 
> > R.version
> platform i386-pc-mingw32
> arch     i386           
> os       mingw32        
> system   i386, mingw32  
> status                  
> major    1              
> minor    7.1            
> year     2003           
> month    06             
> day      16
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list 
> https://www.stat.math.ethz.ch/mailman/listinfo> /r-help
>




More information about the R-help mailing list