Consensus: Construct consensus trees

View source: R/Consensus.R

ConsensusR Documentation

Construct consensus trees

Description

Consensus() calculates the majority-rule or strict consensus of a set of trees, using the cluster-table approach of \insertCiteDay1985TreeTools.

Usage

Consensus(trees, p = 1, check.labels = TRUE, hash = TRUE)

Arguments

trees

List of trees, optionally of class multiPhylo.

p

Proportion of trees that must contain a split for it to be reported in the consensus. p = 0.5 gives the majority-rule consensus; p = 1 (the default) gives the strict consensus.

check.labels

Logical specifying whether to check that all trees have identical labels. Defaults to TRUE, which is slower.

hash

Logical; if TRUE (default), majority/threshold consensus counts splits using 128-bit hashing, which is exact with overwhelming probability (a collision conflating two distinct splits is vanishingly unlikely). Set hash = FALSE for a slower but guaranteed-exact count. Ignored when p = 1, which is always exact.

Details

The strict consensus (p = 1) compares the clusters of the first tree against every other tree in linear time. The majority-rule and threshold consensus (⁠0.5 <= p < 1⁠) instead count the frequency of every split across all trees in a single pass and retain those occurring in a proportion p or more of trees; this runs in time linear in the number of trees, after \insertCiteJansson2016TreeTools. By default the count uses a 128-bit hash, whose results are exact with overwhelming probability; set hash = FALSE for a slower but guaranteed-exact count.

Value

Consensus() returns an object of class phylo, rooted as in the first entry of trees.

Author(s)

Martin R. Smith (martin.smith@durham.ac.uk)

References

\insertAllCited

See Also

  • ConsTree implements other consensus tree algorithms.

  • Rogue increases the resolution of consensus trees by dropping wildcard taxa.

  • TreeDist::ConsensusInfo() calculates the information content of a consensus tree.

Other consensus tree functions: ConsensusWithout(), RoguePlot()

Other tree characterization functions: CladisticInfo(), J1Index(), Stemwardness, TotalCopheneticIndex()

Examples

Consensus(as.phylo(0:2, 8))

TreeTools documentation built on June 2, 2026, 5:06 p.m.