search_wcvp: Search WCVP for a taxon.

View source: R/wcvp.R

search_wcvpR Documentation

Search WCVP for a taxon.

Description

Query the World Checklist of Vascular Plants search API for a taxon string.

Usage

search_wcvp(query, filters = NULL, cursor = "*", limit = 50, .wait = 0.1)

Arguments

query

The taxon string to search WCVP for. If using keywords, the query must be formatted as a list.

filters

Filter to apply to search results. Multiple filters must be supplied as a character vector.

cursor

A cursor returned by a previous search. If used, the query and filter must be exactly the same.

limit

An integer specifying the maximum number of results to return.

.wait

Time to wait before making a request, to help rate limiting.

Details

The World Checklist of Vascular Plants (WCVP) is a global consensus view of all known vascular plant species. It has been compiled by staff at RBG Kew in consultation with plant group experts.

The search API allows users to query the checklist for plant names. Currently, it does not support partial or fuzzy matching. In order to get a result, the user must supply a valid name string. For example, 'Myrcia' and 'Myrcia guianensis' will return results, but 'M' or 'Myr' will not.

There is some support for querying using keyword arguments. The API is not currently documented, so only keywords that are definitely there have been implemented. Use the get_keywords function to view a list of all implemented keywords.

The API will return taxonomic information (the family, authority, status, and rank) of all names matching the query. These results can be limited, for example to accepted species, using filters. Use the get_filters function to view a list of all implemented filters.

Value

Returns an object of class wcvp_search that is a simple structure with slots for:

  • total: the total number of results held in WCVP for the query

  • cursor: a cursor to retrieve the next page of results from the API.

  • limit: the maximum number of results requested from the API.

  • results: the query results parsed into a list.

  • query: the query string submitted to the API.

  • filter: the filter strings submitted to the API.

  • response: the httr response object.

References

WCVP (2020). World Checklist of Vascular Plants, version 2.0. Facilitated by the Royal Botanic Gardens, Kew. Published on the Internet; http://wcvp.science.kew.org/

See Also

  • lookup_wcvp() to lookup information about a taxon name using a valid IPNI ID.

  • download_wcvp() to download the entire WCVP.

Other WCVP functions: download_wcvp(), lookup_wcvp()

Examples

# search for all entries containing a genus name
search_wcvp("Myrcia")

# search for all accepted species within a genus
search_wcvp("Myrcia", filters=c("species", "accepted"))

# search for up to 10,000 species in a genus
search_wcvp("Poa", filters=c("species"), limit=10000)

# search for all names in a family
search_wcvp(list(family="Myrtaceae"))

# search for genera within a family
search_wcvp(list(family="Myrtaceae"), filters=c("genera"))

# search for all names with a specific epithet
search_wcvp(list(species="guianensis"))

# search for a species name and print the results
r <- search_wcvp("Myrcia guianensis", filters=c("species"))
print(r)

# simplify search results to a `tibble`
r <- search_wcvp("Poa", filters=c("species"))
tidy(r)

# accepted name info is nested inside the records for synonyms
# simplify accepted name info to the name ID
r <- search_wcvp("Poa", filters=c("species"))
tidied <- tidy(r)
tidyr::unnest(tidied, cols=synonymOf, names_sep="_")


barnabywalker/kewr documentation built on July 5, 2022, 5:37 p.m.