gbif_citation(x)
occ_search
, occ_download_get
,
a dataset key, or occurrence key (character or numeric).Currently, this function gives back citations at the dataset level, not at the individual occurrence level. If occurrence keys are passed in, then we track down the dataset the key is from, and get the citation for the dataset.
res1 <- occ_search(taxonKey=3119195, limit=2)
(xx <- gbif_citation(res1))
res2 <- occ_search(datasetKey='7b5d6a48-f762-11e1-a439-00145eb45e9a',
return='data', limit=20)
(xx <- gbif_citation(res2))
# if no datasetKey field included, we attempt to identify the dataset
## key field included - still works
res3 <- occ_search(taxonKey=3119195, fields=c('name','basisOfRecord','key'), limit=20)
(xx <- gbif_citation(res3))
## key field not included - errors
# res3 <- occ_search(taxonKey=3119195, fields=c('name','basisOfRecord','protocol'), limit=20)
# (xx <- gbif_citation(res3))
# character class inputs
## pass in a dataset key
gbif_citation(x='0ec3229f-2b53-484e-817a-de8ceb1fce2b')
## pass in an occurrence key
gbif_citation(x='766766824')
# pass in an occurrence key as a numeric
gbif_citation(x=766766824)
# Downloads
## only works with output from occ_download_get for now
d1 <- occ_download_get("0000066-140928181241064", overwrite = TRUE)
gbif_citation(d1)
Run the code above in your browser using DataLab