https://github.com/cran/rgbif
Raw File
Tip revision: 59b72670d80bc2fb2a68d847f828808bcc8a6078 authored by John Waller on 23 May 2024, 12:20:02 UTC
version 3.8.0
Tip revision: 59b7267
enumeration.R
#' Enumerations.
#'
#' Many parts of the GBIF API make use of enumerations, i.e. controlled
#' vocabularies for specific topics - and are available via these functions
#'
#' @export
#'
#' @param x A given enumeration.
#' @template occ
#' @return `enumeration` returns a character vector, while
#' `enumeration_country` returns a data.frame.
#' @examples \dontrun{
#' # basic enumeration
#' enumeration()
#' enumeration("NameType")
#' enumeration("MetadataType")
#' enumeration("TypeStatus")
#'
#' # country enumeration
#' enumeration_country()
#'
#' # curl options
#' enumeration(curlopts = list(verbose=TRUE))
#' }
enumeration <- function(x = NULL, curlopts = list()) {
  url <- paste0(gbif_base(), "/enumeration/basic/", x)
  gbif_GET(url, NULL, parse = TRUE, curlopts)
}

#' @export
#' @rdname enumeration
enumeration_country <- function(curlopts = list()) {
  url <- paste0(gbif_base(), "/enumeration/country/")
  gbif_GET(url, NULL, parse = TRUE, curlopts = curlopts)
}
back to top