R function from {stats} package - hierarchical cluster analysis on a set of dissimilarities and methods for analyzing it.
Questions tagged [hclust]
176 questions
0
votes
1 answer
heatmap.2- Error: Colv dendrogram doesn't match size of x
I am generating a heatmap using R.
I used the hclust function and got the error:
Colv dendrogram doesn't match size of x.
Below is my code, it works perfectly with a square matrix. Now my input matrix is 400x2000. Can someone tell me why I am…

Rtut
- 937
- 3
- 11
- 19
0
votes
2 answers
selecting number of leaf nodes of dendrogram in heatmap.2 in R
In Matlab you can designate the number of nodes in a dendrogram that you wish to plot as part of the dendrogram function: dendrogram(tree,P) generates a dendrogram plot with no more than P leaf nodes.
My attempts to do the same with heatmap2 in R…

user3866594
- 1
- 1
- 2
0
votes
0 answers
Cluster analysis representation in R
I'm doing a cluster analysis on a large spatial dataset where x and y are the spatial coordinates. I'm using hclust and the dynamicTreeCut, and then for the representation I'm showing a scatterplot using ggplot.
But I'm unable to visualize correctly…

user3218784
- 9
- 3
0
votes
1 answer
How to turn a hclust-object into JSON for D3?
I'm attempting to visualize a cluster tree using this awesome D3 layout! However, it needs data in JSON format - how do I go from a hclust-object in R to a hierarchical JSON structure?
set.seed(123)
m <- matrix(runif(100), nrow=10)
cl <-…

jenswirf
- 7,087
- 11
- 45
- 65
-1
votes
1 answer
How to cluster a data frame with two variables and frequency of occurrence
Say I have a data frame with the sample:
structure(list(V1 = c(1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L,
6L, 6L, 6L, 7L, 7L, 7L, 9L, 9L, 9L, 13L, 13L, 13L, 15L, 15L,
18L,…

M.A
- 65
- 1
- 8
-1
votes
2 answers
Coordinate Plot for Clustering Visualitzation/Analysis
I have a dataset (already scaled) consisting of a total of 8 columns:
first column indicating the assigned cluster each observation belongs,
and, 7 dependent variables (each in a different column).
I would like to develop a Clustering…

dsilvat
- 9
- 4
-1
votes
2 answers
Clustering based on co-occurrences
I would like to cluster data based on the co-occurrences keyword using R. I have encountered 2 difficulties compared to other posts.
The words are of different hierarchy levels
The keywords do not necessarily show in the order or the hierarchy…

PeterGerft
- 49
- 1
- 7
-1
votes
1 answer
R: Hierarchical clustering
Let's say we have the following dataset
set.seed(144)
dat <- matrix(rnorm(100), ncol=5)
The following function creates all possible combinations of columns and removes the first
(combinations <- do.call(expand.grid, rep(list(c(F, T)),…

Ceyda Oksel
- 45
- 6
-1
votes
2 answers
cluster ordinal data
I want to do clustering of my data (kmeans or hclust) in R language (coding). My data is ordinal, which means that the data is Likert scale to measure the causes of cost escalation (I have 41 causes "variables") that scaled from 1 to 5, which 1 is…

user2288739
- 11
- 1
- 3
-2
votes
1 answer
How to plot a label with the similarities between groups using R?
When I use the command hclust in R, to plot a dendrogram, I get the y axis labeled as Height. However, I'd like to label this axis with the similarity levels between the groups in my dataset, something like the image below. How can I achieve…

Marcus Nunes
- 851
- 1
- 18
- 33
-4
votes
1 answer
dist in R can only handle data frames, vectors, matrices, and lists
I am trying to run this code to get a hierarchical clustering on the gun point dataset from UCR Time Series database. However I encounter this error. Any help?
library(dtw)
set.seed(6218)
n <- 10
sc <-…

Mona Jalal
- 34,860
- 64
- 239
- 408