I wrote this function in order to create simple summaries of GBIF data per country (i.e. checklists based on the available GBIF information) to supply to other people without R expertise. I suspect there is a lot that could be improved (and perhaps I have even missed something obvious within the rgbif package that would have made it easier). Anyhow, this is where it is at. I have been using the function 'lapply-ed' across a vector of country ISO 2 character codes. Occasionally it fails (particularly with countries where there is a lot of data), hence the try...catch approach for when applying over such lists.
Of course, I realise that GBIF is not comprehensive in its coverage, and that there are often issues that need addressing with occurrence data and taxonomic precision; this code was written for a quick first assessment useful for comparing the presence/absence of potentially invasive species in countries in the context of horizon scanning. Use this code at your own risk!