| Title: | Hierarchical Cluster Analysis (Learning Didactically) |
|---|---|
| Description: | Implements hierarchical clustering methods (single linkage, complete linkage, average linkage, and centroid linkage) with stepwise printing and dendrograms for didactic purposes. |
| Authors: | Gualberto Segundo Agamez Montalvo [aut, cre] |
| Maintainer: | Gualberto Segundo Agamez Montalvo <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-05-13 08:06:19 UTC |
| Source: | https://github.com/cran/hclustTeach |
A function that performs hierarchical clustering with average linkage. It can also print the clustering steps and display a dendrogram
hclust_average( data, metric = "euclidean", print.steps = TRUE, plot = TRUE, label.names = TRUE )hclust_average( data, metric = "euclidean", print.steps = TRUE, plot = TRUE, label.names = TRUE )
data |
Numerical matrix or data frame of observations (rows = observations, columns = variables). |
metric |
Distance metric to be used (default: "euclidean"). |
print.steps |
If TRUE, the algorithm's steps are printed. |
plot |
If TRUE, a dendrogram is plotted. |
label.names |
If TRUE, uses the row names as labels in the dendrogram. |
object of class "hclust".
y1 <- c(1, 2, 1, 0); y2 <- c(2, 1, 0, 2) y3 <- c(8, 8, 9, 7); y4 <- c(6, 9, 8, 9) Data <- rbind(y1, y2, y3, y4) hc <- hclust_average(Data, metric = "euclidean", print.steps = TRUE, plot = TRUE, label.names = TRUE)y1 <- c(1, 2, 1, 0); y2 <- c(2, 1, 0, 2) y3 <- c(8, 8, 9, 7); y4 <- c(6, 9, 8, 9) Data <- rbind(y1, y2, y3, y4) hc <- hclust_average(Data, metric = "euclidean", print.steps = TRUE, plot = TRUE, label.names = TRUE)
A function that performs hierarchical clustering with centroid linkage. It can also print the clustering steps and display a dendrogram
hclust_centroid( data, metric = "euclidean", print.steps = TRUE, plot = TRUE, label.names = TRUE )hclust_centroid( data, metric = "euclidean", print.steps = TRUE, plot = TRUE, label.names = TRUE )
data |
Numerical matrix or data frame of observations (rows = observations, columns = variables). |
metric |
Distance metric to be used (default: "euclidean"). |
print.steps |
If TRUE, the algorithm's steps are printed. |
plot |
If TRUE, a dendrogram is plotted. |
label.names |
If TRUE, uses the row names as labels in the dendrogram. |
object of class "hclust".
y1 <- c(1, 2, 1, 0); y2 <- c(2, 1, 0, 2) y3 <- c(8, 8, 9, 7); y4 <- c(6, 9, 8, 9) Data <- rbind(y1, y2, y3, y4) hc <- hclust_centroid(Data, metric = "euclidean", print.steps = TRUE, plot = TRUE, label.names = TRUE)y1 <- c(1, 2, 1, 0); y2 <- c(2, 1, 0, 2) y3 <- c(8, 8, 9, 7); y4 <- c(6, 9, 8, 9) Data <- rbind(y1, y2, y3, y4) hc <- hclust_centroid(Data, metric = "euclidean", print.steps = TRUE, plot = TRUE, label.names = TRUE)
A function that performs hierarchical clustering with complete linkage. It can also print the clustering steps and display a dendrogram
hclust_complete( data, metric = "euclidean", print.steps = TRUE, plot = TRUE, label.names = TRUE )hclust_complete( data, metric = "euclidean", print.steps = TRUE, plot = TRUE, label.names = TRUE )
data |
Numerical matrix or data frame of observations (rows = observations, columns = variables). |
metric |
Distance metric to be used (default: "euclidean"). |
print.steps |
If TRUE, the algorithm's steps are printed. |
plot |
If TRUE, a dendrogram is plotted. |
label.names |
If TRUE, uses the row names as labels in the dendrogram. |
object of class "hclust".
y1 <- c(1, 2, 1, 0); y2 <- c(2, 1, 0, 2) y3 <- c(8, 8, 9, 7); y4 <- c(6, 9, 8, 9) Data <- rbind(y1, y2, y3, y4) hc <- hclust_complete(Data, metric = "euclidean", print.steps = TRUE, plot = TRUE, label.names = TRUE)y1 <- c(1, 2, 1, 0); y2 <- c(2, 1, 0, 2) y3 <- c(8, 8, 9, 7); y4 <- c(6, 9, 8, 9) Data <- rbind(y1, y2, y3, y4) hc <- hclust_complete(Data, metric = "euclidean", print.steps = TRUE, plot = TRUE, label.names = TRUE)
A function that performs hierarchical clustering with single linkage. It can also print the clustering steps and display a dendrogram
hclust_single( data, metric = "euclidean", print.steps = TRUE, plot = TRUE, label.names = TRUE )hclust_single( data, metric = "euclidean", print.steps = TRUE, plot = TRUE, label.names = TRUE )
data |
Numerical matrix or data frame of observations (rows = observations, columns = variables). |
metric |
Distance metric to be used (default: "euclidean"). |
print.steps |
If TRUE, the algorithm's steps are printed. |
plot |
If TRUE, a dendrogram is plotted. |
label.names |
If TRUE, uses the row names as labels in the dendrogram. |
object of class "hclust".
y1 <- c(1, 2, 1, 0); y2 <- c(2, 1, 0, 2) y3 <- c(8, 8, 9, 7); y4 <- c(6, 9, 8, 9) Data <- rbind(y1, y2, y3, y4) hc <- hclust_single(Data, metric = "euclidean", print.steps = TRUE, plot = TRUE, label.names = TRUE)y1 <- c(1, 2, 1, 0); y2 <- c(2, 1, 0, 2) y3 <- c(8, 8, 9, 7); y4 <- c(6, 9, 8, 9) Data <- rbind(y1, y2, y3, y4) hc <- hclust_single(Data, metric = "euclidean", print.steps = TRUE, plot = TRUE, label.names = TRUE)