Skip to contents

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 = FishLife::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

Value

integer of row numbers of ParentChild_gz matching genus_species

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)