Rgbif name_suggest and key

Hi all,
I am new to rgbif so I may be confused, if so I apologize. I ran the following R-commands and I believe there are some discrepancies:

the following code returns the expected result.
name_suggest(q=‘Vespa velutina nigrithorax’, rank=‘subspecies’)

However, when I enquire information about the key it returns a different species:
occ_get(key=6247411)

it returnes “Ardea herodias Linnaeus, 1758” and not “Vespa velutina nigrithorax”

am I doing it wrong?

Daniel

Hi Daniel,

occ_get() is for specific occurrences. You’ll want to use a function that takes a taxonKey like occ_search(), occ_data() or occ_download(), e.g.,

> taxon<-name_suggest(q="Vespa velutina nigrithorax")
> occ_search(taxon$data$key) 
Records found [31623] 
Records returned [500] 
No. unique hierarchies [1] 
No. media records [500] 
No. facets [0] 
Args [limit=500, offset=0, taxonKey=6247411, fields=all] 
# A tibble: 500 x 130
   key    scientificName decimalLatitude decimalLongitude issues datasetKey publishingOrgKey installationKey publishingCount~ protocol lastCrawled lastParsed crawlId hostingOrganiza~ basisOfRecord occurrenceStatus
   <chr>  <chr>                    <dbl>            <dbl> <chr>  <chr>      <chr>            <chr>           <chr>            <chr>    <chr>       <chr>        <int> <chr>            <chr>         <chr>           
 1 30321~ Vespa velutin~            43.8             3.79 "cdro~ 50c9509d-~ 28eb1a3f-1c15-4~ 997448a8-f762-~ US               DWC_ARC~ 2021-09-19~ 2021-09-1~     282 28eb1a3f-1c15-4~ HUMAN_OBSERV~ PRESENT         
 2 30589~ Vespa velutin~            41.5             1.77 "cdro~ 50c9509d-~ 28eb1a3f-1c15-4~ 997448a8-f762-~ US               DWC_ARC~ 2021-09-19~ 2021-09-1~     282 28eb1a3f-1c15-4~ HUMAN_OBSERV~ PRESENT         
 3 30590~ Vespa velutin~            48.8             2.42 "cdro~ 50c9509d-~ 28eb1a3f-1c15-4~ 997448a8-f762-~ US               DWC_ARC~ 2021-09-19~ 2021-09-1~     282 28eb1a3f-1c15-4~ HUMAN_OBSERV~ PRESENT         
 4 30616~ Vespa velutin~            48.8             2.60 "cdro~ 50c9509d-~ 28eb1a3f-1c15-4~ 997448a8-f762-~ US               DWC_ARC~ 2021-09-19~ 2021-09-1~     282 28eb1a3f-1c15-4~ HUMAN_OBSERV~ PRESENT      

Thank you for your quick reply.
I was following the examples from the Introduction to rgbif, which feeds keys directly into occ_get(). And the occ_get() description says “Get data for GBIF occurrences by occurrence key”. anyway, a bit scary that it returns a different species.

Just to clarify: there are taxon keys and occurrence keys. occ_get() takes an occurrence key to return one specific occurrence, while e.g. occ_search() takes a taxon key to return n occurrences of the requested taxon.

Make sense?

Aha! Yes, that makes total sense. Thank you for clarifying and sorry for the misunderstanding.