cluster: Hierarchical Cluster Analysis

View source: R/cluster.R

clusterR Documentation

Hierarchical Cluster Analysis

Description

Performs hierarchical cluster analysis on a distance matrix generated by the dist() function. This function reads the distance matrix and item names from the DIST output files and creates a dendrogram.

Usage

cluster(notu, method = "average")

Arguments

notu

Number of operational taxonomic units (items) in the dataset.

method

The agglomeration method to be used. This should be one of "ward.D", "ward.D2", "single", "complete", "average" (= UPGMA), "mcquitty" (= WPGMA), "median" (= WPGMC) or "centroid" (= UPGMC). Default is "average".

Value

Invisibly returns a list with the following components:

hclust

The hclust object produced by hclust, which can be further processed or plotted by the user.

cophenetic

The cophenetic correlation coefficient (a single numeric value between -1 and 1) measuring how faithfully the dendrogram represents the original distance matrix. Values closer to 1 indicate a better fit.

dist

The dist object representing the input distance matrix.

Examples

# Requires the CONFOR and DIST executables on the PATH.

try({
  delta <- load_delta(
    system.file("extdata", "chars_viola", package = "RDelta"),
    system.file("extdata", "items_viola", package = "RDelta"),
    system.file("extdata", "specs_viola", package = "RDelta")
  )
  dist(delta)
  res <- cluster(delta$get_items_nb())
  res$cophenetic
  res <- cluster(delta$get_items_nb(), method = "complete")
})


RDelta documentation built on Oct. 28, 2026, 5:12 p.m.