Format scientific species names into a standardised manner.
format_species(
species,
remove_parentheses = TRUE,
abbrev = FALSE,
remove_subspecies = FALSE,
remove_subspecies_exceptions = c("Canis lupus familiaris"),
split_char = " ",
collapse = " ",
remove_chars = c(" ", ".", "(", ")", "[", "]"),
replace_char = "",
lowercase = FALSE,
trim = "'",
standardise_scientific = FALSE
)
Species query
(e.g. "human", "homo sapiens", "hsapiens", or 9606).
If given a list, will iterate queries for each item.
Set to NULL
to return all species.
Remove substring within parentheses: e.g. "Xenopus (Silurana) tropicalis" --> "Xenopus tropicalis"
Abbreviate all taxonomic levels except the last one: e.g. "Canis lupus familiaris" ==> "C l familiaris"
Only keep the first two taxonomic levels: e.g. "Canis lupus familiaris" --> "Canis lupus"
Selected species to ignore when
remove_subspecies=TRUE
.
e.g. "Canis lupus familiaris" --> "Canis lupus familiaris"
Character to split species names by.
Character to re-collapse species names with after splitting
with split_char
.
Characters to remove.
Character to replace remove_chars
with.
Make species names all lowercase.
Characters to trim from the beginning/end of each species name.
Automatically sets multiple arguments at once
to create standardised scientific names for each species. Assumes that
species
is provided in some version of scientific species names:
e.g. "Xenopus (Silurana) tropicalis" --> "Xenopus tropicalis"
A named vector where the values are the standardised species names and the names are the original input species names.
species <- c("Xenopus (Silurana) tropicalis","Canis lupus familiaris")
species2 <- format_species(species = species, abbrev=TRUE)
species3 <- format_species(species = species,
standardise_scientific=TRUE,
remove_subspecies_exceptions=NULL)