Skip to contents

There are some differences in how functions across rgbif behave with respect to many values given to a single parameter. Typically as a user does need to worry about these details, but it can sometimes make a difference.

# multiple API requests 
occ_search(taxonKey=c(1,212))
occ_data(taxonKey=c(1,212))

# single API request 
occ_search(taxonKey="1;212"))
occ_data(taxonKey="1;212"))

In occ_search, there are some parameters you can pass multiple values to in a vector, each value of which produces a different request c("a","b"). Some parameters allow multiple values to be passed in the same request in a semicolon separated string "a;b". Only one argument at a time can have multiple values in different requests.

# works
occ_search(taxonKey="1;2",basisOfRecord = c("PRESERVED_SPECIMEN","LIVING_SPECIMEN","MATERIAL_CITATION"))
occ_search(occurrenceStatus=c("PRESENT","ABSENT"))

# will give error 
occ_search(taxonKey=c(1,2),basisOfRecord = c("PRESERVED_SPECIMEN","LIVING_SPECIMEN","MATERIAL_CITATION"))
occ_search(occurrenceStatus="PRESENT;ABSENT")

When using different requests c("a","b"), you will get back a list equal to the value of your vector. To extract data from multiple different requests, you will need something like the following.

occ_search(taxonKey=c(1,2))[[1]]$data

All occ_search() arguments can take multiple values, except for the following arguments:

  • hasCoordinate
  • hasGeospatialIssue
  • occurrenceStatus
  • search
  • repatriated
  • isInCluster
  • limit
  • offset