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

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

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.

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.

Examples

my_species <- data.frame(species = c("Boa constrictor", "Pantherophis guttatus", "Fake species"))
reptCompare(my_species)
#> No RDB list provided, comparing with internal data 'allReptiles'
#>                 species  status
#> 1       Boa constrictor matched
#> 2          Fake species  review
#> 3 Pantherophis guttatus matched
reptCompare(my_species, filter = "review")
#> No RDB list provided, comparing with internal data 'allReptiles'
#> [1] "Fake species"
reptCompare(my_species, filter = "matched")
#> No RDB list provided, comparing with internal data 'allReptiles'
#> [1] "Boa constrictor"       "Pantherophis guttatus"