closest_relative: Find the closest relative of a taxon among a set of...

View source: R/distance.R

closest_relativeR Documentation

Find the closest relative of a taxon among a set of candidates

Description

Given a query taxon and a vector of candidate taxa, returns the candidate with the smallest phylogenetic distance to the query.

Usage

closest_relative(taxon, candidates, verbose = FALSE)

Arguments

taxon

A character string giving the query taxon name.

candidates

A character vector of candidate taxon names to compare against.

verbose

Logical. If TRUE, prints progress messages. Default FALSE.

Value

A data frame with columns taxon (candidate name) and distance (tree metric distance), sorted by distance ascending. Returns NULL if the query taxon cannot be found.

Examples


closest_relative("Tyrannosaurus",
  c("Velociraptor", "Triceratops", "Brachiosaurus", "Allosaurus"))


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