R/reptAdvancedSearch.R
reptAdvancedSearch.RdCreates a search URL for retrieving species lists from RDB based on multiple filters.
This URL is primarily used by reptSpecies, but can also be used manually for advanced queries.
If a synonym is provided and can be unambiguously matched to a valid species, the function also prints detailed information for that species.
reptAdvancedSearch(
higher = NULL,
genus = NULL,
year = NULL,
common_name = NULL,
synonym = NULL,
location = NULL,
verbose = TRUE,
exact = FALSE
)Character string. A higher-level reptile taxon above genus (e.g., "snakes" or "Boidae").
Character string. The current valid name of a reptile genus (e.g., "Apostolepis").
Character string. Filters the search by year of species description (e.g., "2025").
Character string. A common name potentially linked to a species or genus (e.g., "tree boa").
Character string. A name potentially regarded as a synonym of a valid taxon (e.g., "Boa diviniloqua").
Character string. A country or region name used to list species expected to occur there.
Logical. To be passed to reptSpecies() in the case of a provided synonym corresponds unambiguously to a valid species.
If TRUE, prints status messages and species information in the console. Default is TRUE.
Logical. To return outputs that matches exactly the searched term (e.g., avoid returning genus "Boaedon" when searching for "Boa"). Default is FALSE.
A character string containing the URL to be used in reptSpecies.
If a provided synonym corresponds unambiguously to a valid species, the function also prints species information retrieved from RDB to the console.
The argument exact does not work properly for searches using logical arguments (e.g. AND/OR).
If you want to force an exact match (e.g., "Boa" as a phrase) with multiple terms (e.g., "Boa OR Apostolepis"),
you must manually include quotes in the input string, e.g., "\"Boa\" OR Apostolepis".
Logical operators (e.g., OR, AND) are supported and will be properly formatted in the search.
To exclude terms, use a leading minus sign (e.g., higher = "-snakes") following RDB's query syntax, instead of using NOT.
When a synonym is matched to a single valid species, the function will also display the species' full information as a side effect.
# \donttest{
reptAdvancedSearch(higher = "snakes", year = "2010", location = "Brazil")
#> Species found: 7
#> Proceed to reptSpecies() with the returned link
#> [1] "https://reptile-database.reptarium.cz/advanced_search?taxon=snakes&year=2010&location=Brazil&submit=Search"
reptAdvancedSearch(year = "2010 OR 2011 OR 2012")
#> Species found: 431
#> Proceed to reptSpecies() with the returned link
#> [1] "https://reptile-database.reptarium.cz/advanced_search?year=2010+OR+2011+OR+2012&submit=Search"
reptAdvancedSearch(genus = "Apostolepis OR \"Boa\" OR Atractus") #quotes "Boa"
#> Species found: 193
#> Proceed to reptSpecies() with the returned link
#> [1] "https://reptile-database.reptarium.cz/advanced_search?genus=Apostolepis+OR+%22Boa%22+OR+Atractus&submit=Search"
# }