R/rl_threats.R

Defines functions rl_threats_ rl_threats

Documented in rl_threats rl_threats_

#' Get species threats by taxon name, IUCN id, and region
#'
#' @export
#' @template commonargs
#' @template all
#' @template info
#' @examples \dontrun{
#' rl_threats('Fratercula arctica')
#' rl_threats('Fratercula arctica', region = 'europe')
#' rl_threats(id = 12392)
#' rl_threats(id = 22694927, region = 'europe')
#' rl_threats(name = 'Abies numidica')
#' rl_threats_('Fratercula arctica')
#'
#' rl_threats(id = 62290750)
#' }
rl_threats <- function(name = NULL, id = NULL, region = NULL, key = NULL,
                       parse = TRUE, ...) {
  assert_is(parse, 'logical')
  rl_parse(rl_threats_(name, id, region, key, ...), parse)
}

#' @export
#' @rdname rl_threats
rl_threats_ <- function(name = NULL, id = NULL, region = NULL,
                        key = NULL, ...) {
  assert_is(key, 'character')
  rr_GET(nir("threats/species/name", "threats/species/id",
             name, id, region), key, ...)
}

Try the rredlist package in your browser

Any scripts or data that you put into this service are public.

rredlist documentation built on Aug. 26, 2017, 9:03 a.m.