knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.width = 7, fig.height = 5 )
The reptiledbr
package allows users to access taxonomic information of reptiles directly from R without the constant need to make web queries to The Reptile Database server. This provides several advantages:
This vignette demonstrates how to perform local searches using the package's main functions.
The reptiledbr
package offers three key functions for performing local taxonomic searches:
reptiledbr_exact()
: For exact searches of scientific namesreptiledbr_partial()
: For searches that allow partial matches (fuzzy matching)search_reptiledbr()
: Flexible function that combines exact and partial search capabilitieslist_subspecies_reptiledbr()
: To obtain information about subspeciesThe reptiledbr_exact()
function verifies if the provided species names exist exactly as written in the database. This function is useful when you need to verify the validity of specific taxonomic names.
library(reptiledbr) # Define a vector of species names to search species_names <- c( "Lachesis muta", "Python bivittatus", "Crotalus atrox", "Bothrops atrox insularis", # Trinomial (with subspecies) - will generate an error "Lachesis sp", "Crotalus atroxx", # Intentional typo "Anolis liogaster", "Lachesis mutta", # Intentional typo "Python bivitatus" # Intentional typo ) # Perform exact search reptiledbr_exact(species_names)
As can be observed, the exact search only returns matches for names that are correctly written. Names with typos or incorrect formats (such as trinomials) are not recognized.
The reptiledbr_partial()
function is more flexible and uses fuzzy matching techniques to identify species even when there are minor typos or variations in spelling.
# Perform search with partial matching reptiledbr_partial(species_names)
Notice how reptiledbr_partial()
was able to find matches for "Crotalus atroxx", "Lachesis mutta", and "Python bivitatus" despite the typos, but still does not recognize incorrect formats such as trinomials or incomplete names (e.g., "Lachesis sp").
The search_reptiledbr()
function offers greater flexibility, allowing you to specify whether to use partial matching or not:
# Define a list of valid species subspecies_names <- c("Lachesis muta", "Anilius scytale", "Anolis bahorucoensis", "Anolis baleatus", "Crotalus atrox", "Anolis barahonae", "Anolis bremeri") # Exact search (without fuzzy matching) search_reptiledbr(subspecies_names, use_fuzzy = FALSE)
A particularly useful feature is the ability to list all recognized subspecies for a given species using list_subspecies_reptiledbr()
:
# List all subspecies for the found species search_reptiledbr(subspecies_names, use_fuzzy = FALSE) |> list_subspecies_reptiledbr()
We can also combine partial matching search and subspecies retrieval:
# Partial matching search followed by subspecies listing reptiledbr_partial(c("Lachesis mutta", "Python bivitatus", "Anolis barahonae")) |> list_subspecies_reptiledbr()
For working with large taxonomic datasets, we recommend the following workflow:
reptiledbr_exact()
to identify names that match exactlyreptiledbr_partial()
to capture possible typoslist_subspecies_reptiledbr()
to obtain detailed information about subspecies when neededThe reptiledbr
package provides efficient tools for verifying and obtaining taxonomic information about reptiles without the need to make constant queries to The Reptile Database serverusing reptiledbr::search_reptiledbr()
. This greatly facilitates working with large datasets and allows for consistent taxonomic verification even without an internet connection.
The local search functions are particularly useful for researchers and professionals working with herpetological data, enabling efficient cleaning and validation of species lists, identification of common typos, and access to up-to-date taxonomic information about reptiles.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.