0

here Is a dendrogram, as you can see there are 3 clusters:

enter image description here

here is the corresponding distance table :

> round(cophenetic(hclust_avg), digits=3)

           g1    g2    g3    g4    g5    g6    g7    g8    g9   g10
    g2  0.000                                                      
    g3  3.027 3.027                                                
    g4  3.027 3.027 0.000                                          
    g5  0.000 0.000 3.027 3.027                                    
    g6  0.000 0.000 3.027 3.027 0.000                              
    g7  0.000 0.000 3.027 3.027 0.000 0.000                        
    g8  3.027 3.027 2.683 2.683 3.027 3.027 3.027                  
    g9  3.027 3.027 2.683 2.683 3.027 3.027 3.027 0.000            
    g10 0.000 0.000 3.027 3.027 0.000 0.000 0.000 3.027 3.027      
    g11 3.027 3.027 0.000 0.000 3.027 3.027 3.027 2.683 2.683 3.027

and what I would like is to get from this a table such as :

g1  g2  g3  g4  g5  g6  g7  g8  g9 g10 g11 
1   1   2   2   1   1   1   3   3   1   2 

where I put in the same group the number values that have a distance = 0.

Thanks for your time.

Community
  • 1
  • 1
chippycentra
  • 879
  • 1
  • 6
  • 15
  • Hi chippycentra. Please show us what you have tried! :) – zabop Mar 01 '19 at 12:42
  • Hello @zabop , I tried `cut_avg <- cutree(hclust_avg, k = 3)` but this solution is not really suitable because the K will change at any time I use the script and is difficult to estimate with the real data... – chippycentra Mar 01 '19 at 12:44
  • 1
    Check [this](https://stackoverflow.com/questions/47776054/r-cluster-analysis-and-dendrogram-with-correlation-matrix/47777081#47777081) and [this](https://stackoverflow.com/questions/15376075/cluster-analysis-in-r-determine-the-optimal-number-of-clusters?rq=1) posts – patL Mar 01 '19 at 12:48
  • Thank you very much – chippycentra Mar 01 '19 at 13:56
  • Did your problem solved? – nghauran Mar 01 '19 at 14:29
  • By using the best k value yes but not with the initial question. – chippycentra Mar 01 '19 at 14:39

0 Answers0