Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

occ_count

Get number of occurrence records.


Description

Get number of occurrence records.

Usage

occ_count(
  taxonKey = NULL,
  georeferenced = NULL,
  basisOfRecord = NULL,
  datasetKey = NULL,
  date = NULL,
  typeStatus = NULL,
  country = NULL,
  year = NULL,
  from = 2000,
  to = 2012,
  type = "count",
  publishingCountry = "US",
  protocol = NULL,
  curlopts = list()
)

Arguments

taxonKey

Species key

georeferenced

Return only occurrence records with lat/long data (TRUE) or those that don't have that data (FALSE, default). Note that you can also get record count with occ_search() by setting limit=0

basisOfRecord

Basis of record

datasetKey

Dataset key

date

Collection date

typeStatus

A type status. See typestatus() dataset for options

country

Country data was collected in, two letter abbreviation. See https://countrycode.org/ for abbreviations.

year

Year data were collected in

from

Year to start at

to

Year to end at

type

One of count (default), schema, basisOfRecord, countries, or year.

publishingCountry

Publishing country, two letter ISO country code

protocol

Protocol. E.g., 'DWC_ARCHIVE'

curlopts

list of named curl options passed on to HttpClient. see curl::curl_options for curl options

Details

There is a slight difference in the way records are counted here vs. results from occ_search(). For equivalent outcomes, in the occ_search() function use hasCoordinate=TRUE, and hasGeospatialIssue=FALSE to have the same outcome for this function using georeferenced=TRUE.

Value

A single numeric value, or a list of numerics.

Supported dimensions

That is, there are only a certain set of supported query parameter combinations that GBIF allows on this API route. They can be found with the call occ_count(type='schema'). They are also presented below:

  • basisOfRecord

  • basisOfRecord, country

  • basisOfRecord, country, isGeoreferenced

  • basisOfRecord, country, isGeoreferenced, taxonKey

  • basisOfRecord, country, taxonKey

  • basisOfRecord, datasetKey

  • basisOfRecord, datasetKey, isGeoreferenced

  • basisOfRecord, datasetKey, isGeoreferenced, taxonKey

  • basisOfRecord, datasetKey, taxonKey

  • basisOfRecord, isGeoreferenced, taxonKey

  • basisOfRecord, isGeoreferenced, publishingCountry

  • basisOfRecord, isGeoreferenced, publishingCountry, taxonKey

  • basisOfRecord, publishingCountry

  • basisOfRecord, publishingCountry, taxonKey

  • basisOfRecord, taxonKey

  • country

  • country, datasetKey, isGeoreferenced

  • country, isGeoreferenced

  • country, isGeoreferenced, publishingCountry

  • country, isGeoreferenced, taxonKey

  • country, publishingCountry

  • country, taxonKey

  • country, typeStatus

  • datasetKey

  • datasetKey, isGeoreferenced

  • datasetKey, isGeoreferenced, taxonKey

  • datasetKey, issue

  • datasetKey, taxonKey

  • datasetKey, typeStatus

  • isGeoreferenced

  • isGeoreferenced, publishingCountry

  • isGeoreferenced, publishingCountry, taxonKey

  • isGeoreferenced, taxonKey

  • issue

  • publishingCountry

  • publishingCountry, taxonKey

  • publishingCountry, typeStatus

  • taxonKey

  • taxonKey, typeStatus

  • typeStatus

  • protocol

  • year

References

https://www.gbif.org/developer/occurrence#metrics

Examples

## Not run: 
occ_count(basisOfRecord='OBSERVATION')
occ_count(georeferenced=TRUE)
occ_count(country='DE')
occ_count(country='CA', georeferenced=TRUE, basisOfRecord='OBSERVATION')
occ_count(datasetKey='9e7ea106-0bf8-4087-bb61-dfe4f29e0f17')
occ_count(year=2012)
occ_count(taxonKey=2435099)
occ_count(taxonKey=2435099, georeferenced=TRUE)

# Just schema
occ_count(type='schema')

# Counts by basisOfRecord types
occ_count(type='basisOfRecord')

# Counts by basisOfRecord types and taxonkey
occ_count(taxonKey=2435099, basisOfRecord='OBSERVATION')

# Counts by typeStatus
occ_count(typeStatus='ALLOTYPE')
occ_count(typeStatus='HOLOTYPE')

# Counts by countries. publishingCountry must be supplied (default to US)
occ_count(type='countries')

# Counts by year. from and to years have to be supplied, default to 2000
# and 2012
occ_count(type='year', from=2000, to=2012)

# Counts by publishingCountry, must supply a country (default to US)
occ_count(type='publishingCountry')
occ_count(type='publishingCountry', country='BZ')

# Pass on curl options
occ_count(type='year', from=2000, to=2012, curlopts = list(verbose = TRUE))

## End(Not run)

rgbif

Interface to the Global 'Biodiversity' Information Facility API

v3.5.2
MIT + file LICENSE
Authors
Scott Chamberlain [aut, cre] (<https://orcid.org/0000-0003-1444-9135>), Damiano Oldoni [aut] (<https://orcid.org/0000-0003-3445-7562>), Vijay Barve [ctb] (<https://orcid.org/0000-0002-4852-2567>), Peter Desmet [ctb] (<https://orcid.org/0000-0002-8442-8025>), Laurens Geffert [ctb], Dan Mcglinn [ctb] (<https://orcid.org/0000-0003-2359-3526>), Karthik Ram [ctb] (<https://orcid.org/0000-0002-0233-1757>), rOpenSci [fnd] (https://ropensci.org/)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.