taxo_cluster: Cluster taxa by taxonomic distance

View source: R/distance.R

taxo_clusterR Documentation

Cluster taxa by taxonomic distance

Description

Computes pairwise taxonomic distances and performs hierarchical clustering.

Usage

taxo_cluster(taxa, method = "average", ...)

Arguments

taxa

A character vector of taxon names, or a dist object from distance_matrix().

method

Clustering method passed to stats::hclust(). Default "average" (UPGMA), which works well with taxonomic distances.

...

Additional arguments passed to distance_matrix() (e.g. verbose, progress).

Value

An object of class "taxodist_cluster" — a list with:

hclust

The stats::hclust() result.

dist

The underlying distance matrix.

See Also

taxo_ordinate(), distance_matrix()

Examples


taxa <- c("Tyrannosaurus", "Velociraptor", "Triceratops", "Brachiosaurus")
cl <- taxo_cluster(taxa)
if (!is.null(cl$hclust)) {
  plot(cl)
}


taxodist documentation built on May 6, 2026, 1:06 a.m.