Skip to contents

Given a vector of selected taxon names and a taxonomy data frame, count how many are "unique" in the sense that parent taxa are not counted when a more specific descendant is also selected.

Usage

compute_unique_taxa(selected_taxa, taxonomy_data)

Arguments

selected_taxa

Character vector of taxon names.

taxonomy_data

Data frame with at least columns: taxon, Order, Suborder, Superfamily, Family, Genus, Species.

Value

Integer count of unique taxa.

Details

A taxon is treated as a parent of another when all of its non-NA rank fields (e.g. Order, Suborder, Superfamily, Family, Genus, Species) match the corresponding fields of the other taxon. Parents that are ancestors of any other selected taxon are not counted as unique.