Questions tagged [hclust]

R function from {stats} package - hierarchical cluster analysis on a set of dissimilarities and methods for analyzing it.

176 questions
2
votes
2 answers

hclust size limit?

I'm new to R. I'm trying to run hclust() on about 50K items. I have 10 columns to compare and 50K rows of data. When I tried assigning the distance matrix, I get: "Cannot allocate vector of 5GB". Is there a size limit to this? If so, how do I go…
Judy
  • 53
  • 1
  • 7
1
vote
1 answer

Retrieving members from clusters (leafs)

Once you build up clusters using hclust, then cutree to specify the down-clusters; how can you retrieve the members forming the different clusters? Suppose you created a simple hierarchical cluster, what command can retrieve the elements…
user764186
  • 951
  • 2
  • 9
  • 12
1
vote
0 answers

For a dendrogram plot in R, how to add custom text while coloring the branches according to the clusters?

I have this dendrogram: hc <- hclust(dist_s, method = 'average') At first, I was showing it with dendextend: dend = as.dendrogram(hc) par(mar = c(3, 2, 2, 8)) dend %>% set("labels_cex", 0.9) %>% set("branches_k_color", value =…
1
vote
1 answer

For hclust1a-->dendrogram-->hclust1b in R, why plot for hclust1a and hclust1b differs?

I have a hclust object named hc1a. I convert it to a dendrogram object, which is in turn converted back to a hclust object and name it as hc1b: # Create hc1a and plot hc1a <- list() hc1a$merge <- matrix(c(-8, -9, -1, -2, …
Patrick
  • 1,057
  • 9
  • 23
1
vote
0 answers

How to put a sample of my data in dendrogram generated with hclust package in R

I want to put in the labels of my dendrogram the samples name that I have in column 1 associated with the environments that I have in column 2, but I cannot find the solution. I am using this code of hclust package: d <- dist(mydata, method =…
1
vote
1 answer

External dendrogram does not keep the same formation when using it for cluster_rows in complexheatmap

I am trying to create a heatmap with an external dendrogram using the ComplexHeatmap library . df <- data.frame(genes=c("G1","G2","G3","G4","G5","G6","G7","G8","G9","G10", …
1
vote
1 answer

Simple dendogram trouble in r programming using hclust

I have a dataset where i am trying to cluster a column with 986 observations with the below code. PremiumPrice_Sclaed <- scale(data$PremiumPrice) plot(PremiumPrice_Sclaed) d <- dist(PremiumPrice_Sclaed) #scale for cluster fit.average <- hclust(d,…
Gordon O
  • 11
  • 1
1
vote
1 answer

Bray–Curtis distance calculation method in Complexheatmap?

I'm using the Complexheatmap function (or "Heatmap") in R and was wondering if there was a way to use the Bray-Curtis method in calculating col/row distance (with ward.D2 clustering method) since it's not a supported method in Complexheatmap. I need…
Nate
  • 411
  • 2
  • 10
1
vote
0 answers

Is there any way of starting a clustering algorithm (hclust) on a database that already is clustered?

I have a database (df) that is already clustered (Class) but I want to further group together those clusters with a hierarchical algorithm. I tried using "member" in the function hclust() but it keeps rebuilding the tree entirely dendo <-…
Alvaro dM
  • 11
  • 1
1
vote
1 answer

Cluster analysis in R (hclust): how to determine which variable is driving the clusters

I'm using hclust to perform a cluster analysis of plant species cover data across sampling sites. My study observed percent cover of 55 species at 100 sites. Plant cover at each site was measured in cover classes of 0-4, where 0 is absent, '1' is…
1
vote
1 answer

R and SPSS: Different results for Hierarchical Cluster Analysis

I'm performing hierarchical cluster analysis using Ward's method on a dataset containing 1000 observations and 37 variables (all are 5-point likert-scales). First, I ran the analysis in SPSS via CLUSTER Var01 to Var37 /METHOD…
nick_m
  • 11
  • 2
1
vote
1 answer

How to compare consistency between clustering results and list of values with different levels in R?

I'm currently struggling for a problem that may seem easy to solve, and that was maybe answered in previous questions, but I can't find anything on the net about this problematic. I'm currently doing a clustering analysis on some data (k-means,…
user6409752
1
vote
1 answer

Hclust object from Factorminer does not cluster dendrogram in Pheatmap

Cross posted: https://www.biostars.org/p/450365/ I am trying to create a heatmap of a matrix with 20 rows and 10 columns using pheatmap::pheatmap. To cluster the columns, I am using an hclust object obtained after running FactoMineR::HCPC on the…
Komal Rathi
  • 4,164
  • 13
  • 60
  • 98
1
vote
1 answer

hang parameter in plot.dendrogram doesn't work (saying ["hang" is not a graphical parameter])

After I have updated to R version 3.6.1 (and updated all the packages), I can't use hang parameter with plot.dendrogram anymore: data(mtcars) hc <- hclust(dist(mtcars)) plot(hc) # works as expected den <- as.dendrogram(hc) plot(den) # it…
Vasily A
  • 8,256
  • 10
  • 42
  • 76
1
vote
2 answers

How to draw plot.dendrogram with labels at different levels (like plot.hclust)?

when I use default plot() for hclust object, it places leaves' labels at different distances, just as I need: data(mtcars) plot(hclust(dist(mtcars))) But when I do the same for dendrogram object, it aligns all labels to the same…
Vasily A
  • 8,256
  • 10
  • 42
  • 76