Skip to contents

Get an assessment summary for a particular class

Usage

rl_class(
  class = NULL,
  key = NULL,
  parse = TRUE,
  all = TRUE,
  page = 1,
  quiet = FALSE,
  ...
)

rl_class_(class = NULL, key = NULL, all = TRUE, page = 1, quiet = FALSE, ...)

Arguments

class

(character) The name of the class to look up. If not supplied, a list of all class names will be returned.

key

(character) An IUCN API token. See rl_use_iucn.

parse

(logical) Whether to parse the output to list (FALSE) or, where possible, data.frame (TRUE). Default: TRUE

all

(logical) Whether to retrieve all results at once or not. If TRUE we do the paging internally for you and bind all of the results together. If FALSE, only a single page of results will be retrieved.

page

(integer/numeric) Page to get if all is FALSE. Default: 1. Each page returns up to 100 records. Paging is required because it's too much burden on a server to just "get all the data" in one request.

quiet

(logical) Whether to suppress progress for multi-page downloads or not. Default: FALSE (that is, give progress). Ignored if all = FALSE.

...

Includes the following filters that are supported by the API endpoint (refer to the API docs for more information):

  • year_published: (integer) Set this to return only assessments from a given year.

  • latest: (logical) Set this to TRUE to return only the latest assessment for each taxon.

  • scope_code: (integer) Set this to return only assessments from a particular scope (e.g., 1 for Global, 2 for Europe). This is similar to the region argument of the old Red List API and old versions of rredlist.

Also supports any curl options passed to the GET request via HttpClient.

Value

A list unless using a function with a trailing underscore, in which case json as character string is returned.

References

API docs at https://api.iucnredlist.org/.

See also

Examples

if (FALSE) { # \dontrun{
# Get assessment summary for class
ex1 <- rl_class(class = "Mammalia")
nrow(ex1$assessments)
} # }