Questions tagged [hclust]

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

176 questions
0
votes
1 answer

Labelling a hclust dendogram using multiple factors

I am doing some hierarchical cluster analyses of some ecological data & I am struggling w/the labels, which are numeric and all but meaningless: dendogram w/meaningless labels Essentially I would like to bind together the two factorial columns in my…
0
votes
0 answers

Plotting a dendrogram with actual data as 'height' of the tree, and not distances, in R

I want to generate a dendrogram out of an association matrix (i.e., a squared matrix that contains association data for each pair of individuals in my population). The dendrogram should show the association index (scale 0 to 1) on the y axis and…
Eve
  • 1
0
votes
0 answers

Use hclust function with a custom distance for linkage methods

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?
0
votes
1 answer

Clustering based on location and timestamp

I have a dataset with longitude, latitude and timestamp. I want to use hierarchical clustering to cluster points that are within x miles and t duration. I understand I can use hclust and dbscan function but all of these take only one argument.…
0
votes
1 answer

Show(plot(hc)) returns NULL when using hclust in R

I am using VSCode and I am trying to visualize a dendrogram produced by hclust(). My data set (baseMini) is made of 2d vectors and so far this is what I have done: dd <- dist(x = baseMini, method = "euclidean") hc <- hclust(d = dd, method =…
leplata
  • 123
  • 5
0
votes
1 answer

cutting a dendogram in R USArrests dataset does not return a proper dendogram

I have been looking online for tutorial but the result is not correct d <- dist(USArrests, method = "euclidean") # distance matrix usarrests_hi_cluster <- hclust(d, method="complete") plot(usarrests_hi_cluster) This works fine and I get the…
0
votes
0 answers

(Hierarchical) clustering detection with categorical variables in R using hclust

I am trying to find a hierarchical pattern in categorical data that I have. The data is sort of like this (as I am not allowed to use the actual data, I created a similar problem that follows my own data's structure/question): I want to investigate…
0
votes
2 answers

Clustering of dissimilar matrix with NA values for heatmap without imputation

I am trying to make a heatmap of a dissimilar matrix that a lot of NAs. However, I ran into problems when trying to perform clustering. Without clustering the heatmap works fine. I do not want to impute/remove the NAs. Is there anyway to perform…
Wolfje
  • 1
  • 4
0
votes
0 answers

Documentation or code sample for agglomerative clustering

for my undergraduate research project, I'm looking for an R code for agglomerative clustering. Basically, I need to know what happened inside hclust method in R. I have looked everywhere but don't find a proper way to combine 2 data points that have…
0
votes
1 answer

How can I show a dendrogram in the plot pane in R-Studio

I am producing a dendrogram using the following code: #Hierarchial Clustering hc<-hclust(distance_matrix,method='average') plot(hc, cex=0.35, hang=-1) The plot shows in the RMD window but not in the plot pane. How can I make it show-up in the…
Jamie
  • 555
  • 3
  • 14
0
votes
1 answer

Should I use vegdist or dist for hclust?

I am trying to do a hierarchical cluster analysis with binary data, and for the distance matrix I applied the function vegdist() from vegan package: dist.jac <- vegdist(final_df, method="jaccard", binary = TRUE) Next, I used the function hclust but…
0
votes
1 answer

Project a horizontal dendrogram

Folks: Is there a way to make a dendrogram generated from function like hclust() horizontal, without using the function as.dendrogram(). So not to loose the enhancement code (i.e, rect.hclust, xlab, ylab, etc.) developed for the original hclust…
RMS
  • 11
  • 1
0
votes
2 answers

define data.frame as a distance and perform hierarchical clustering in R

ggg <- data.frame(row.names=c("a","b","c","d","e"),var1=c("0","0","0","0","0"),var2=c("1","1","1","1","2")) ggg_dist <- as.matrix(ggg) %>% as.dist(.) In as.dist.default(.) : non-square matrix class(ggg_dist) [1] "dist" ggg_dist Warning…
takeITeasy
  • 350
  • 3
  • 19
0
votes
1 answer

how to plot hclust objects up to certain number of cuts?

I try to plot an hclust object. The plot looks ok but I would like to have a plot that doesn't go all the way down but stops at 5 cuts. I tried ylim but this doesn't change anything to the plot. My code is library(datasets) data <- iris dist <-…
havaey
  • 9
  • 1
  • 5
0
votes
1 answer

Zoom and plot only specific node for a given dendogram

Hi suppose I generated a dendogram as such: library(dendextend) library(tidyverse) mtcars %>% select(mpg, cyl, disp) %>% dist() %>% hclust() %>% as.dendrogram() -> dend dend %>% set("nodes_pch", 19) %>% …
Ahdee
  • 4,679
  • 4
  • 34
  • 58