Learn R Programming

spocc (version 0.5.0)

as.gbif: Coerce occurrence keys to gbifkey/occkey objects

Description

Coerce occurrence keys to gbifkey/occkey objects

Usage

as.gbif(x)

Arguments

x
Various inputs, including the output from a call to occ (class occdat), occ2df (class data.frame), or a list, numeric, character, gbifkey, or occkey.

Value

  • One or more in a list of both class gbifkey and occkey

Details

Internally, we use occ_get, whereas occ uses occ_search. We can use occ_get here because we have the occurrence key to go directly to the occurrence record.

Examples

Run this code
spnames <- c('Accipiter striatus', 'Setophaga caerulescens', 'Carduelis tristis')
out <- occ(query=spnames, from=c('gbif','ebird'), gbifopts=list(hasCoordinate=TRUE), limit=2)
res <- occ2df(out)
(tt <- as.gbif(out))
(uu <- as.gbif(res))
as.gbif(as.numeric(res$key[1]))
as.gbif(res$key[1])
as.gbif(as.list(res$key[1:2]))
as.gbif(tt[[1]])
as.gbif(uu[[1]])
as.gbif(tt[1:2])

Run the code above in your browser using DataLab