Search species: Ported from https://github.com/James-Thorson-NOAA/FishLife/blob/main/R/Search_species.R
Source:R/search_species.R
search_species.Rd
Match taxonomic inputs to a given row of ParentChild_gz
or its closest ancestor
Usage
search_species(
Class = "predictive",
Order = "predictive",
Family = "predictive",
Genus = "predictive",
Species = "predictive",
add_ancestors = TRUE,
Database = marlin::FishBase_and_RAM,
ParentChild_gz = Database$ParentChild_gz
)
Arguments
- Class
Character input for taxonomic class
- Order
Character input for taxonomic class
- Family
Character input for taxonomic class
- Genus
Character input for taxonomic class
- Species
Character input for taxonomic class
- add_ancestors
Boolean whether to add ancestors for matching species or not
- ParentChild_gz
vector providing index of parent-taxon for every child-taxa
Details
This function attempts to do a smart match to elements of ParentChild_gz
. It sweeps from Order to Species
and ignores any taxonomic input listed as "predictive"
until it finds something else. It then appends
"predictive"
to any lower taxonomic level that is missing, and checks whether this specification yields a single,
unique taxon. If it does, it then returns the row number and potentially any ancestors (higher taxonomic levels)