rgbif

An interface to the GBIF API for the R statistical programming environment

Map of occurrences generated using rgbif
Map of occurrences generated using rgbif

rgbif is an R package from rOpenSci that allows searching and retrieving data from GBIF. rgbif wraps R code around the GBIF API to allow you to talk to GBIF from R and access metadata, species names, and occurrences.

Installing the package in R is simple:

> install.packages("rgbif")

Once installed, rgbif allows you to easily

  • get data for single occurrences
  • retrieve multiple occurences
  • search for taxon names
  • generate maps of occurences

Full functionality is described in the rgbif tutorial.  The rgbif package is also part of the SPOCC Species Occurrence Data suite, that provides access to occurrence records from multiple databases.

Citing data retrieved via rgbif

The rgbif library includes a function, gbif_citation, that will help you properly cite the data downloaded from GBIF. To use, simply pass either a single occurrence key, a dataset key, or the results of a call to the occ_search function.

Examples:

Get citation for a single occurrence, passing the occurrence key as an argument
> gbif_citation(x=1265576727)
<<rgbif citation>>
   Citation: iNaturalist.org (2017). iNaturalist Research-grade Observations.
        Occurrence Dataset https://doi.org/10.15468/ab3s5x accessed via
        GBIF.org on 2017-10-18.. Accessed from R via rgbif
        (https://github.com/ropensci/rgbif) on 2017-10-18
   Rights:
Get citation for a dataset, passing the dataset key as an argument
> gbif_citation(x='d52d01f6-7472-4dbf-9ea8-a33c343255ac')
<<rgbif citation>>
   Citation: Moeslund J E (2016). Vegetation data from protected areas in
        Denmark (<U+00A7> 3 in the Danish Nature Protection Act). Version 8.1.
        Department of Bioscience, Aarhus University. Occurrence Dataset
        https://doi.org/10.15468/ar7pbr accessed via GBIF.org on 2017-10-18..
        Accessed from R via rgbif (https://github.com/ropensci/rgbif) on
        2017-10-18
   Rights:
Get citations for several occurrences in a combined search, passing the results of a call to the occ_search function:
> my_search <- occ_search(taxonKey=2440940, country='DK')
> gbif_citation(my_search)
[[1]]
<<rgbif citation>>
   Citation: Baag<U+00F8>e H J, Secher Jensen T, Calabuig I (2016). Atlas of Danish
        Mammals. Danish Biodiversity Information Facility. Occurrence Dataset
        https://doi.org/10.15468/r2kvnz accessed via GBIF.org on 2017-10-18..
        Accessed from R via rgbif (https://github.com/ropensci/rgbif) on
        2017-10-18
   Rights:

[[2]]
<<rgbif citation>>
   Citation: Museum f<U+00FC>r Naturkunde Berlin. MfN - Fossil vertebrates IV.
        Occurrence Dataset https://doi.org/10.15468/kneffk accessed via
        GBIF.org on 2017-10-18.. Accessed from R via rgbif
        (https://github.com/ropensci/rgbif) on 2017-10-18
   Rights:
Get citation for asynchronous downloads

To get a citation for a specific download request, it’s recommeded to use the DOI issued with the download. This can be found in the download metadata accesible by a direct call to the GBIF API (http://api.gbif.org/v1/occurrence/download/<download key>) or on the download web page: https://www.gbif.org/occurrence/download/<download key>. For example:

Download key: 0005737-171002173027117
API: http://api.gbif.org/v1/occurrence/download/0005737-171002173027117
Web: https://www.gbif.org/occurrence/download/0005737-171002173027117

Citations

Scott Chamberlain (2017). rgbif: Interface to the Global ‘Biodiversity’ Information Facility ‘API’. R package version 0.9.8. https://CRAN.R-project.org/package=rgbif