Skip to contents

This function checks a list of species names against the Red Book of Endemic Plants of Peru database and provides information about whether a species was recorded as endemic, and checks for misspelling typos (fuzzy match).

Usage

check_redbooklist(splist, dist = 0.02)

Arguments

splist

A character vector containing the species names to be checked.

dist

Maximum allowed distance for fuzzy matching of species names.

Value

A character vector indicating if each input species name is listed as "endemic" in the Red Book of Endemic Plants of Peru database. Returns "endemic" if the species name is listed and "not endemic" if no matching entry is found.

Details

This function checks each species name in the provided list against the Red Book of Endemic Plants of Peru database using fuzzy matching based on the specified maximum distance (dist). It provides information about the endemic status of each species and flags if the recorded name needs updating. It also counts the number of exact and fuzzy matches found.

Examples

# Example usage of the function
splist <- c("Aphelandra cuscoenses",
            "Piper stevensi",
            "Sanchezia ovata",
            "Verbesina andina",
            "Festuca dentiflora",
            "Eucrosia bicolor var. plowmanii",
            "Hydrocotyle bonplandii var. hirtipes",
            "Persea americana")

# Basic usage
check_redbooklist(splist = splist, dist = 0.2)
#> Total exact matches: 4
#> Total fuzzy matches: 2
#> [1] "endemic"     "endemic"     "not endemic" "endemic"     "endemic"    
#> [6] "endemic"     "endemic"     "not endemic"

# Using base R with a data frame
plant_list <- data.frame(splist = splist)
plant_list$label <- check_redbooklist(plant_list$splist, dist = 0.2)
#> Total exact matches: 4
#> Total fuzzy matches: 2
plant_list
#>                                 splist       label
#> 1                Aphelandra cuscoenses     endemic
#> 2                       Piper stevensi     endemic
#> 3                      Sanchezia ovata not endemic
#> 4                     Verbesina andina     endemic
#> 5                   Festuca dentiflora     endemic
#> 6      Eucrosia bicolor var. plowmanii     endemic
#> 7 Hydrocotyle bonplandii var. hirtipes     endemic
#> 8                     Persea americana not endemic