0

i would like to portray the 5 Clusters in a dendrogram wie rect.dendrogram but i get an error:

# 5 Cluster in Dendrogramm 
rect.dendrogram(clust5, k=5, border="red")
# Error: Fehler: $ operator is invalid for atomic vectors

Has someone a solution? Do I have to transform the dataset clust5?

Thanks!

benaja
  • 137
  • 11
  • welcome to SO. Could you try to provide a [Minimal Reproducible Example](https://stackoverflow.com/a/5963610/13513328), or at least the result of `dput(head(clust5))` – Waldi Sep 03 '21 at 11:58
  • Hi, sure! Result: c(`1` = 1L, `2` = 2L, `3` = 3L, `4` = 1L, `5` = 3L, `6` = 1L) MRE: # dist_Cluster_Daten <- dist(Cluster_Daten_stand, method = "euclidean") dist_Cluster_Daten # clust1 <- hclust(dist_Cluster_Daten, method = "ward.D2") # plot(clust1) # clust5 <- cutree(clust1, k=5) – Paulina Schmidt Sep 03 '21 at 12:57
  • `clust5` is a vector and not the result of a cluster calculation which should return a list whose elements can be accessed by the `$` operator. Hence the error – Waldi Sep 03 '21 at 13:02
  • Oh wow thanks! I am pretty new in the r-dimension. where should i put the $ operator? – Paulina Schmidt Sep 03 '21 at 13:15
  • 1
    perhaps start with the examples of [rect.dendogram](https://www.rdocumentation.org/packages/dendextend/versions/1.15.1/topics/rect.dendrogram) – Waldi Sep 03 '21 at 13:18

0 Answers0