Skip to contents

Takes a vector of species names and checks whether those species are represented within a CompadreDB object. It outputs either a data frame depicting the species of interest and whether they occur in the database (TRUE/FALSE), or, if return_db == TRUE, a CompadreDB object subset to the species of interest.

Usage

cdb_check_species(cdb, species, return_db = FALSE)

Arguments

cdb

A CompadreDB object

species

Character vector of binomial species names, with the genus and specific epithet separated by either an underscore or a space (e.g. c("Acipenser_fulvescens", "Borrelia_burgdorferi"))

return_db

Logical argument indicating whether a database should be returned

Value

If return_db == FALSE, returns a data frame with a column of species names and a column indicating whether a species occurs in the database. If return_db == TRUE, returns a subset of cdb containing only those species within argument species.

See also

Other data checking: cdb_collapse(), cdb_compare(), cdb_flag(), mpm_methods

Author

Danny Buss <dlb50@cam.ac.uk>

Owen R. Jones <jones@biology.sdu.dk>

Rob Salguero-Gomez <rob.salguero@zoo.ox.ac.uk>

Patrick Barks <patrick.barks@gmail.com>

Examples

species <- c("Primula vulgaris", "Trillium ovatum", "Homo sapiens")
cdb_check_species(Compadre, species)
#>            species in_db
#> 1 Primula vulgaris  TRUE
#> 2  Trillium ovatum  TRUE
#> 3     Homo sapiens FALSE
CompadreSubset <- cdb_check_species(Compadre, species, return_db = TRUE)