Skip to contents

Project Status: Active – The project has reached a stable, usable state and is being actively developed. cran checks R-CMD-check real-requests codecov.io rstudio mirror downloads cran version DOI

rgbif is an R package which gives you access to GBIF mediated data via its REST API.

GBIF (the Global Biodiversity Information Facility) is an international network and data infrastructure funded by the world’s governments and aimed at providing anyone, anywhere, open access to data about all types of life on Earth.

Installation

install.packages("rgbif") # CRAN version
pak::pkg_install("ropensci/rgbif") # dev version
install.packages("rgbif", repos="https://dev.ropensci.org") # dev version

Getting Started

⚠️ Breaking Change in rgbif 3.9.0: The default taxonomy changed from GBIF Backbone to COL (Catalogue of Life) Extended Release, which uses alpha-numeric taxon keys instead of numeric keys. See the Migration Guide for details on updating your code.

There are several long-form articles that can help get you started:

Most GBIF users are interested in getting lat-lon occurrence records.

occ_search(scientificName = "Pan troglodytes")
occ_data(scientificName = "Pan troglodytes")

It is usually better to get occurrence records using a taxonKey. See the article Working With Taxonomic Names.

taxonKey <- name_backbone("Pan troglodytes")$usageKey
occ_search(taxonKey = taxonKey)

GBIF strongly recommends the use of occ_download() rather than occ_search() for serious research projects. See article Getting Occurrence Data From GBIF.

If repeated requests are made to the GBIF search API via occ_search(), users will be temporatily paused for 5 seconds. Please use occ_download() for bulk downloads.

It is required to set up your GBIF credentials to make downloads from GBIF.

# By default, name_backbone() and occ_download() use COL (Catalogue of Life) Extended Release
# which returns alpha-numeric taxon keys (e.g., "4C92G" for Pan troglodytes)
taxonKey <- name_backbone("Pan troglodytes")$usageKey
occ_download(pred("taxonKey", taxonKey))

# For GBIF Backbone Taxonomy, explicitly set checklistKey to the backbone UUID
backbone_uuid <- "d7dddbf4-2cf0-4f39-9b2a-bb099caae36c"
taxonKey_gbif <- name_backbone("Pan troglodytes", checklistKey = backbone_uuid)$usageKey  
occ_download(pred("taxonKey", taxonKey_gbif), checklistKey = backbone_uuid)

# 4C92G taxonKey for Pan troglodytes in COL Extended Release

Citation

Under the terms of the GBIF data user agreement, users who download data agree to cite a DOI. Please see GBIF’s citation guidelines and Citing GBIF Mediated Data.

Please also cite rgbif by running citation(package = "rgbif").

Meta

  • Please report any issues or bugs.
  • License: MIT
  • Get citation information for rgbif in R doing citation(package = 'rgbif')
  • Please note that this package is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

There are similar GBIF clients in other languages :

This package is part of spocc, along with several other packages, that provide access to occurrence records from multiple data sources.