rl_sp: Get species

View source: R/rl_sp.R

rl_spR Documentation

Get species

Description

Get species

Usage

rl_sp(page = 0, key = NULL, parse = TRUE, all = FALSE, quiet = FALSE, ...)

rl_sp_(page, key = NULL, all = FALSE, quiet = FALSE, ...)

Arguments

page

(integer/numeric) Page to get. Default: 0. you can get up to 10,000 records per page. Paging is required because it's too much burden on a server to just "get all the data" in one request

key

A IUCN API token. See rl_use_iucn.

parse

(logical) Whether to parse to list (FALSE) or data.frame (TRUE). Default: TRUE

all

(logical) to get all results or not. Default: FALSE. this means we do the paging internally for you. result is a list of results, so you have to bind them together yourself into a data.frame, see example

quiet

(logical) give progress for download or not. Default: FALSE (that is, give progress). ignored if all = FALSE

...

Curl options passed to HttpClient

Examples

## Not run: 
rl_sp(page = 3)

# get all results
out <- rl_sp(all = TRUE)
length(out)
vapply(out, "[[", 1, "count")
all_df <- do.call(rbind, lapply(out, "[[", "result"))
head(all_df)
NROW(all_df)

## End(Not run)

ropensci/rredlist documentation built on Nov. 18, 2022, 6:03 p.m.