Description Usage Arguments Value Examples
Plots a dendrogram where the colors of the segments represent cluster membership. Note that the cluster labels may not match the cluster labels in other sequenchr::plot_* functions.
1 | plot_dendrogram(cluster_model, k, h = 100)
|
cluster_model |
a clustering model such as the output from hclust |
k |
the number of clusters |
h |
the minimum height to plot the segments. A lower height results in decreased performance |
ggplot object
1 2 3 4 5 6 7 8 9 10 11 12 | library(TraMineR)
data(mvad)
seqstatl(mvad[, 17:86])
mvad.alphabet <- c("employment", "FE", "HE", "joblessness", "school",
"training")
mvad.labels <- c("employment", "further education", "higher education",
"joblessness", "school", "training")
mvad.seq <- seqdef(mvad, 17:86, alphabet = mvad.alphabet,
labels = mvad.labels, xtstep = 6)
dist_matrix <- TraMineR::seqdist(seqdata = mvad.seq, method = "DHD")
cluster_model <- hclust(d = as.dist(dist_matrix), method = 'ward.D2')
plot_dendrogram(cluster_model, 5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.