R function from {stats} package - hierarchical cluster analysis on a set of dissimilarities and methods for analyzing it.
Questions tagged [hclust]
176 questions
2
votes
1 answer
How to associate cluster labels and dendrogram in the same order on a plot
I'm trying to associate my cluster labels to the corresponding dendrogram, the problem is that the dendrogram does not use the order i want, it's ordering the cluster from the left to the right...
I've seen some other post like this one which is a…

D Prat
- 352
- 4
- 16
2
votes
1 answer
Color branches of a dendrogram based on column in dataframe
I want to color the branches of a dendrogram based on the value in a column of a dataframe used in the hclust function.
Before you mark this question as duplicate as was done in this question, which links to this question. Note that this was…

Matthew Snyder
- 383
- 2
- 11
2
votes
1 answer
R: How to identify and label cluster groups in a dendrogram (created by hclust)?
I have used hclust to identify clusters in my data, and determine the nature of those clusters. The following is a very simplified version:
gg <- c(1,2,4,3,3,15,16)
hh <- c(1,10,3,10,10,18,16)
z <- data.frame(gg,hh)
means <- apply(z,2,mean)
sds <-…

B.Kenobi
- 209
- 3
- 6
2
votes
2 answers
Cluster labels are cut off on horizontal hclust dendrogram
I used hclust and as.dendogram to make a dendrogram, but when I rotate it to a horizontal orientation, the model names are cut off. How can I make sure that the plot shows the entire model names?

Milton Alves
- 47
- 6
2
votes
1 answer
is there a way to preserve the clustering in a heatmap but reduce the number of observations?
I have data-set with 90 observations(rows) across 20 columns. I have generated a pretty neat heatmap which clusters my data in two groups with the package pheatmap. Although its not entirely clean but the two clusters of dendrogram pretty much…

ivivek_ngs
- 917
- 3
- 10
- 28
2
votes
1 answer
dendextend: color_branches not working for certain hclust methods
I am using R dendextend package to plot hclust tree objects generated by each hclust method from hclust{stats}: "ward.D", "ward.D2", "single", "complete", "average" (= UPGMA), "mcquitty" (= WPGMA), "median" (= WPGMC) or "centroid" (= UPGMC).
I…

Zach Roe
- 23
- 4
2
votes
1 answer
rotating dendogram x axis label in R
I am giving the example data provided by hclust help:
mds2 <- -cmdscale(UScitiesD)
hcity.D <- hclust(UScitiesD, "ward.D")
plot(hcity.D, hang=-1)
When you plot this the site labels are vertical- which is appropriate for this example since they use…

Birdonawire
- 199
- 3
- 10
2
votes
0 answers
Why results are different in hclust and heat map.2 using same clustering functions?
I'm trying to understand a bit more my data doing some clustering analysis. Using the same data, I've done first a hclust with this code:
# Dissimilarity matrix
df <-scale(m.sel)
d <- dist(df, method = "euclidean")
# Hierarchical clustering using…

Fabiola Fernández
- 262
- 3
- 14
2
votes
0 answers
hcpc and hclust functions give different results for mixed classification
I started to do a hierarchical classification on mixed datas using "hclust". However, the results do not contain any details about the variables importance for each cluster. That's why I did a classification using "HCPC" which give all these…

tang
- 21
- 1
2
votes
2 answers
R hclust height of final merge
When performing the hierarchical clustering in R with the hclust function.
How do you know the height of the final merge?
So to clarify with some R default data:
hc <- hclust(dist(USArrests))
dendrogram1 = as.dendrogram(hc)
plot(hc)
Will result…

Sleenee
- 594
- 1
- 8
- 21
2
votes
2 answers
How can I highlight specific labels in a dendrogram?
I made a cluster analysis using simple following code
hc2 = hclust(dist(geno.imp))
pdf(file="file.pdf", width=50)
plot(hc2,cex=0.2)
dev.off()
I want to highlight some of the specific leaves (not the nodes). I have the list of those leaves in a…

user3533677
- 21
- 2
2
votes
1 answer
Interpreting the result of 'cutree' from hclust/heatmap.2
I have the following code that perform hiearchical clustering and plot
them in heatmap.
set.seed(538)
# generate data
y <- matrix(rnorm(50), 10, 5, dimnames=list(paste("g", 1:10, sep=""),
paste("t", 1:5, sep="")))
# the actual data is much larger…

neversaint
- 60,904
- 137
- 310
- 477
2
votes
2 answers
Consensus tree or "bootstrap proportions" from multiple hclust objects
I have a list of hclust objects resulting from slight variations in one variable (for calculating the distance matrix)
now I would like to make a consensus tree from this list.
Is there a generic package to do this? I am hacking my way…
user198711
2
votes
1 answer
Assign a cluster to an object in R
What's the easiest way to assign a cluster to a group in R?
The functions utilized are:
hclust and cutree.
Basically, I want to assign one of the clusters created under cutree to an object.
Thanks!
user2105555
2
votes
0 answers
Does there already exist an R package that can print any list to the console as a tree (using ASCII symbols)?
I would find it convenient to be able to print out any list-mode R object using the same format as str.dendrogram. I wrote my own function that kind of works, but there's no point in duplicating effort. So, does anybody know of any packages that…

bokov
- 3,444
- 2
- 31
- 49