% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/distance.R
\name{closest_relative}
\alias{closest_relative}
\title{Find the closest relative of a taxon among a set of candidates}
\usage{
closest_relative(taxon, candidates, verbose = FALSE)
}
\arguments{
\item{taxon}{A character string giving the query taxon name.}

\item{candidates}{A character vector of candidate taxon names to compare
against.}

\item{verbose}{Logical. If \code{TRUE}, prints progress messages. Default \code{FALSE}.}
}
\value{
A data frame with columns \code{taxon} (candidate name) and \code{distance}
(tree metric distance), sorted by distance ascending. Returns \code{NULL} if
the query taxon cannot be found.
}
\description{
Given a query taxon and a vector of candidate taxa, returns the candidate
with the smallest phylogenetic distance to the query.
}
\examples{
\donttest{
closest_relative("Tyrannosaurus",
  c("Velociraptor", "Triceratops", "Brachiosaurus", "Allosaurus"))
}
}
