search_avesperu | R Documentation |
This function searches for bird species information in the dataset provided by
the avesperu
package, given a list of species names. It supports approximate
(fuzzy) matching to handle typographical errors or minor variations in the
species names. The function returns detailed information for each species,
including taxonomic data, common names, and status.
search_avesperu(splist, max_distance = 0.1)
splist |
A character vector containing the names of bird species to search for. Names can include minor variations or typos. |
max_distance |
Numeric. The maximum allowable distance for fuzzy matching, which can either be a proportion (0 < max_distance < 1) or an integer representing the maximum number of allowed differences. Defaults to 0.1. |
The function performs the following steps:
Validates the input, ensuring that splist
is a character vector or a factor.
Standardizes species names and identifies duplicate entries in the list.
For each unique species name, it searches for matches in the dataset using
approximate string matching (agrep
), with a customizable max_distance
.
Retrieves the taxonomic and common name data for the closest matching species.
If no matches are found for a species, the corresponding row in the output will
contain NA
values.
A data frame with the following columns:
The species name provided as input.
The closest matching species name from the dataset, or NA
if no match is found.
The taxonomic order of the species.
The taxonomic family of the species.
The common name of the species in English.
The common name of the species in Spanish.
The conservation or other status of the species.
The computed distance between the submitted name and the matched name.
# Example: Search for bird species in the dataset
splist <- c("Falco sparverius", "Tinamus osgodi", "Crypturellus soui",
"Thraupis palmarum", "Thamnophilus praecox")
search_avesperu(splist)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.