Fetch (and cache) the WoRMS <-> ITIS cross-reference for a set of taxa
Source:R/xref.R
fetch_taxon_xref.RdResolves each requested identifier through the authority that can answer it,
and returns one row per query with the accepted ids, the authority's real
status, and the date it was checked:
Arguments
- itis_ids
integer ITIS TSNs to crosswalk (NA/duplicates dropped)
- worms_ids
integer WoRMS AphiaIDs to backfill an
itis_idfor- names
character source names; cleaned with
clean_taxon_name()first- cache_csv
path to the cross-reference cache CSV (
metadata/taxon_xref.csv); read if it exists, rewritten when anything new is fetched.NULLfetches everything and caches nothing.- refresh
logical; re-fetch queries already cached (and re-date them)
- sleep
seconds between API calls (rate limit)
- verbose
logical; report what was cached vs fetched
Details
itis_ids— exact TSN -> AphiaID crosswalk viaworrms::wm_record_by_external(type = "tsn"), plus the ITIS-accepted TSN viataxize::itis_acceptname(). This is where a bird gains itsworms_idwithout losing itsitis:key.worms_ids— the reverse direction,worrms::wm_external(type = "tsn"), backfillingitis_idon WoRMS-keyed taxa.names—worrms::wm_records_name()onclean_taxon_name()output, the fallback for taxa carrying neither id.
Queries already present in cache_csv are not re-fetched, so a re-run is free
and offline. notes accumulates datestamped lines and is never rewritten.