write_taxa_map: Write a taxa map by joining input taxa with ITIS data

View source: R/write_taxa_map.R

write_taxa_mapR Documentation

Write a taxa map by joining input taxa with ITIS data

Description

This function takes a data frame of taxa names and joins them with ITIS data from a local taxadb database, producing a standardized taxa map suitable for downstream workflows. The function preserves input order, checks for duplicate matches and row count consistency (with warnings), and writes the result to taxa_map.csv.

Usage

write_taxa_map(taxa_df, taxa_col)

Arguments

taxa_df

A data frame containing taxa names to be mapped.

taxa_col

The unquoted column name in taxa_df containing the taxa names.

Details

The function uses helper functions to connect to the taxadb database, retrieve the ITIS table, and determine the correct table name. It uses taxadb::clean_names() to standardize input names and dplyr for data manipulation. Validation is performed using pointblank to warn about duplicate matches and row count mismatches.

Value

Invisibly returns the taxa map data frame (also written to taxa_map.csv).

Examples

## Not run: 
sample_taxa <- data.frame(scientific_name = c("Homo sapiens", "Panthera"))
write_taxa_map(sample_taxa, scientific_name)

## End(Not run)


CAPLTER/capeml documentation built on July 16, 2025, 3:57 p.m.