R/gbif_downstream.R
gbif_downstream.Rd
Retrieve all taxonomic names downstream in hierarchy for GBIF
gbif_downstream(
id,
downto,
intermediate = FALSE,
limit = 100,
start = NULL,
key = NULL,
...
)
A taxonomic serial number.
The taxonomic level you want to go down to. See examples below.
The taxonomic level IS case sensitive, and you do have to spell it
correctly. See data(rank_ref)
for spelling.
(logical) If TRUE, return a list of length two with target taxon rank names, with additional list of data.frame's of intermediate taxonomic groups. Default: FALSE
Number of records to return. default: 100. max: 1000. use in
combination with the start
parameter
Record number to start at. default: 0. use in combination
with the limit
parameter
Deprecated, see id
Further args passed on to gbif_name_usage()
data.frame of taxonomic information downstream to family from e.g.,
Order, Class, etc., or if intermediated=TRUE
, list of length two,
with target taxon rank names, and intermediate names.
Sometimes records don't have a canonicalName
entry which is
what we look for. In that case we grab the scientificName
entry.
You can see the type of name colleceted in the column name_type
if (FALSE) {
## the plant class Bangiophyceae
gbif_downstream(id = 198, downto="genus")
gbif_downstream(id = 198, downto="genus", intermediate=TRUE)
# families downstream from the family Strepsiptera (twisted wing parasites)
gbif_downstream(id = 1227, "family")
## here, intermediate leads to the same result as the target
gbif_downstream(id = 1227, "family", intermediate=TRUE)
if (interactive()) {
# Lepidoptera
gbif_downstream(id = 797, "family")
# get species downstream from the genus Ursus
gbif_downstream(id = 2433406, "species")
# get tribes down from the family Apidae
gbif_downstream(id = 7799978, downto="species")
gbif_downstream(id = 7799978, downto="species", intermediate=TRUE)
# names that don't have canonicalname entries for some results
# Myosotis: key 2925668
key <- 2925668
res <- gbif_downstream(key, downto = "species")
res2 <- downstream(key, db = "gbif", downto = "species")
# Pagination
# GBIF limits queries to a maximum of 1000 records per request, so if
# there's more than 1000, use the start parameter
# Piper, taxonKey = 3075433
x1 <- gbif_downstream(id = 3075433, downto = "species", limit=1000)
x2 <- gbif_downstream(id = 3075433, downto = "species", limit=1000,
start=1000)
x3 <- gbif_downstream(id = 3075433, downto = "species", limit=1000,
start=2000)
x4 <- gbif_downstream(id = 3075433, downto = "species", limit=1000,
start=3000)
rbind(x1, x2, x3, x4)
}
}