0

I want to do an agglomerative clustering with R, but I want to use my own distance as a linkage method instead of the ones already predefined. How can I can I embed my own distance as a linkage method using the function hclust in R?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
  • The function is defined as `hclust(d, method = "complete", members = NULL)`, where `d` is a dissimilarity matrix as produced by function `dist`. Your custom dissimilarity function should return an object compatible with `dist`'s return value. Is this what you are looking for? – Rui Barradas Apr 24 '22 at 09:47
  • Suppose that I use the correlation dissimilarity. Will the function hclust use this distance in the linkage method as well? – Toney Shields Apr 24 '22 at 10:33
  • 1
    Yes, it will. `hclust` will operate on the dissimilarity matrix it is given. – Rui Barradas Apr 24 '22 at 13:29

0 Answers0