% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Consensus.R
\name{Consensus}
\alias{Consensus}
\title{Construct consensus trees}
\usage{
Consensus(trees, p = 1, check.labels = TRUE, hash = TRUE)
}
\arguments{
\item{trees}{List of trees, optionally of class \code{multiPhylo}.}

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

\item{check.labels}{Logical specifying whether to check that all trees have
identical labels.  Defaults to \code{TRUE}, which is slower.}

\item{hash}{Logical; if \code{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 \code{hash = FALSE} for a slower but guaranteed-exact count.
Ignored when \code{p = 1}, which is always exact.}
}
\value{
\code{Consensus()} returns an object of class \code{phylo}, rooted as in the
first entry of \code{trees}.
}
\description{
\code{Consensus()} calculates the majority-rule or strict consensus of a set of
trees, using the cluster-table approach of \insertCite{Day1985}{TreeTools}.
}
\details{
The strict consensus (\code{p = 1}) compares the clusters of the first tree
against every other tree in linear time.  The majority-rule and threshold
consensus (\verb{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 \code{p} or
more of trees; this runs in time linear in the number of trees, after
\insertCite{Jansson2016}{TreeTools}.  By default the count uses
a 128-bit hash, whose results are exact with overwhelming probability; set
\code{hash = FALSE} for a slower but guaranteed-exact count.
}
\examples{
Consensus(as.phylo(0:2, 8))
}
\references{
\insertAllCited{}
}
\seealso{
\itemize{
\item \href{https://constree.github.io/}{\pkg{ConsTree}} implements
other consensus tree algorithms.
\item \href{https://ms609.github.io/Rogue/}{\pkg{Rogue}} increases the resolution of
consensus trees by dropping wildcard taxa.
\item \code{TreeDist::ConsensusInfo()} calculates the information content of a
consensus tree.
}

Other consensus tree functions:
\code{\link[=ConsensusWithout]{ConsensusWithout()}},
\code{\link[=RoguePlot]{RoguePlot()}}

Other tree characterization functions:
\code{\link[=CladisticInfo]{CladisticInfo()}},
\code{\link[=J1Index]{J1Index()}},
\code{\link{Stemwardness}},
\code{\link[=TotalCopheneticIndex]{TotalCopheneticIndex()}}
}
\author{
\href{https://orcid.org/0000-0001-5660-1727}{Martin R. Smith}
(\href{mailto:martin.smith@durham.ac.uk}{martin.smith@durham.ac.uk})
}
\concept{consensus tree functions}
\concept{tree characterization functions}
