Downloading GBIF datasets

Looking up species taxon keys

I chose to use the Ring-Tailed Lemur (Lemur catta) for demonstrative purposes.

name_backbone(name = "Lemur catta", rank = "species")
Taxon key

In the next step, you will need a taxon key. Here, the taxon key is equivalent to the usageKey.

What is the usageKey of Lemur catta?

usageKey <- 2436412
# alternatively
usageKey <- name_backbone(name = "Lemur catta", rank = "species") %>%
                 pull(usageKey)

Looks like there are a lot of possible taxon keys for Lemur catta. I searched it in GBIF taxonomic backbone instead: 2436412

Sending request to download file

Remember to fill in your own GBIF login credentials for "user", "pwd" and "email"

gbif_download_key <- occ_download(pred("taxonKey", 2436412),
                              format = "SIMPLE_CSV",
                             user = "*****",
                             pwd = "******",
                             email = "*******")

Actually downloading the file

occ_download_wait(gbif_download_key)

gbif_download <- occ_download_get(gbif_download_key,
                                  overwrite = TRUE) %>%
                 occ_download_import() %>%
                 setNames(tolower(names(.)))

head(gbif_download, 10) #view first ten rows
download

Retrieving the citation of the downloaded dataset to use in your report

print(gbif_citation(occ_download_meta(gbif_download_key))$download)