Learn R Programming

letsRept (version 1.1.0)

reptCompare: Compare species nomenclature between datasets or with Reptile Database Data

Description

This function compares a list of species (x) with another list (y), typically from the Reptile Database (RDB). If y is not provided, it defaults to using the internal object allReptiles, extracted from RDB (version: May, 2025). The function returns species from xthat are either unmatched ("review") or matched with y or with allReptiles, if y is NULL. If y is provided and any species from x is a valid name according to RDB but is absent from y, it receives the status absent

Usage

reptCompare(x = NULL, y = NULL, filter = NULL, compareDataset = FALSE)

Value

A character vector (if filter is "review", "matched" or "absent), or a data frame with columns:

species

Species names from x

status

Comparison result: "review", "matched" or "absent"

If compareDataset = TRUE, then the function returns a vector of species from y that is absent from x.

Arguments

x

A character vector or a data frame containing a column named species with species names to be compared.

y

Optional. A character vector or a data frame containing a column named species to be compared. Defaults to the internal object allReptiles.

filter

Optional. A character string or a vector of characters. If "review", returns only unmatched species. If "matched", returns only matched species. If "absent", returns only species from x that are absent from y. If NULL (default), returns a data frame with all species and respective statuses. Multiple filters can be concatenated and the resulting data frame will return all species with both status.

compareDataset

Logical. If TRUE, assumes all input names are up-to-date and compares the input list with the reference database to identify any missing species.

Examples

Run this code
my_species <- data.frame(species = c("Boa constrictor", "Pantherophis guttatus", "Fake species"))
reptCompare(my_species)
reptCompare(my_species, filter = "review")
reptCompare(my_species, filter = "matched")

Run the code above in your browser using DataLab