trim_taxa | R Documentation |
Trim excess text from taxa names. Doing this before querying a taxonomic authority improves matching.
trim_taxa(x = NULL, path = NULL)
x |
(character) A list of taxa names |
path |
(character) The path to the directory containing taxa_map.csv |
Characters trimmed by this function:
White spaces (trailing and leading)
Species abbreviations following a genus value (e.g. "Sp.", "Spp.", "Cf.", "Cf...", etc.)
If using x
, then an updated list of taxa is returned.
If using path
, then an updated version of taxa_map.csv
is written to file and returned as a data frame.
# Input a list of names
my_taxa <- c("Koeleria_cristata", "Cyperus sp.", "Poa Cf. ")
my_taxa <- trim_taxa(x = my_taxa)
my_taxa
# Input taxa_map.csv
data <- data.table::fread(system.file("example_data.txt", package = 'taxonomyCleanr'))
my_path <- tempdir()
tm <- create_taxa_map(path = my_path, x = data, col = "Species")
tm <- trim_taxa(path = my_path)
tm
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.