rgbif2: Gets occurrence data from GBIF

View source: R/rgbif2.R

rgbif2R Documentation

Gets occurrence data from GBIF

Description

This function uses the rgbif package to get occurrence data of a species.

Usage

rgbif2(
  dir = "results/",
  filename = "output",
  species,
  n.records = 5000,
  force = FALSE,
  remove_na = FALSE,
  save = FALSE,
  file.format = "csv",
  compress = FALSE,
  ...
)

Arguments

dir

Path to directory where the file will be saved. Default is to create a "results/" directory

filename

Name of the output file

species

Name of the family, genus or species (i.e. genus and specific epithet separated by space). Accepts author if inserted correctly. Either a single character or a vector.

n.records

Number of records to return. Default to 5000.

force

Logical. Force downloading data for more than 10 species in a loop. Default force = FALSE

remove_na

Logical. Should records with NA in the columns decimalLatitude and decimalLongitude be removed? Default to FALSE.

save

Logical. Save output to filename? Defaults to FALSE

file.format

Character. The file extension to be used for saving ('csv' or 'rds'). Default to 'csv'.

compress

Logical. Should the file be compressed? Default to FALSE.

...

Any argument from occ_search in rgbif package

Details

Despite its name, the argument species can be used to declare names at any taxonomic level (i.e. species, genus, family, order, etc.). But not that for some names with homonyms, you may need to declare the authorship as well so that GBIF can return the records for the right taxon key.

By default, the function returns a maximum of 5000 records for each query. This limit can be changed using the argument n.records. But note that the maximum request imposed by the function rgbif::occ_search() is 100,000 records per taxon. This may be the case for the download of records for entire families or orders and in this case only the first 100,000 records are returned with a warning. So, please consider downloading records separately for different regions, basis of records and/or higher taxonomic levels (i.e. genera or species).

The time of download will depend on the number of taxa selected and the maximum number of records requested for download, as well as on the speed of the internet connection. If you want to download large dataset, consider doing your request using the GBIF web interface and load the DwC-A zip file using the plantR function readData().

IMPORTANT NOTE: plantR currently does not provide tools to cite data following the GBIF citation guidelines. So, it is necessary that the user identify the dataset publishers and properly acknowledge each of them when citing the data. We recommend the package occCite (Owens et al. 2021) to help citing data. Another option is to manually create a derived dataset and assign a unique DOI that can be used to cite the dataset (check more instructions here).

Value

A data.frame with the search result. Columns species_id and download are added by the function. It can save the search output on disk

Author(s)

Sara R. Mortara, Andrea Sánchez-Tapia & Renato A. F. de Lima

References

Hannah L. Owens, Cory Merow, Brian Maitner, Jamie M. Kass, Vijay Barve and Robert P. Guralnick (2021). occCite: Querying and Managing Large Biodiversity Occurrence Datasets. R package version 0.4.6. https://CRAN.R-project.org/package=occCite

Examples

## Not run: 
ex_rgbif  <- rgbif2(species =  "Paubrasilia echinata")
ex_rgbif1 <- rgbif2(species =  "Alouatta fusca")

## End(Not run)


LimaRAF/plantR documentation built on Jan. 1, 2023, 10:18 a.m.