This function is used to relate the occurrence records from GBIF returned by the function gbif_records() with geographic features of interest and select the species occurrences that are not in the data to be updated for those geographic features. The function requires the package 'sf'

rec_update(gbif_occ, geography, geo_name, data, sp_name, num_rec = 5)

Arguments

gbif_occ

The resulting data frame from the gbif_records() funtion in the 'caribmacro' package

geography

A shapefile of the geographic features of interest. Must be read in using the st_read() function of the 'sf' package (e.g. multipolygon shapefile of Caribbean island banks)

geo_name

A character equal to the column name of the shapefile attribute table in which the geographic feature names are stored (e.g. bank names)

data

A data frame of the data to be updated

sp_name

A character equal to the column name of the 'data' that has the species' binomial names

num_rec

A number equal to the number of records needed to denote a credible species record on a particular bank. The default is num_rec = 5

Value

A data frame of species records filtered from the data frame returned by gbif_records

for geographic features in a shapefile and matched to a database of records.

Examples

if (FALSE) {

library(here)
library(sf)

banks <- st_read(file.path(here(), 'data_raw', 'gis', 'Carib_Banks.shp'))
dat <- read.csv(file.path(here(), 'data_raw', 'IBT_Herp_Records_final.csv'), header=TRUE)

## records is a data frame returned by gbif_records()

new_recs <- rec_update(gbif_occ = records,
                       geography = banks,
                       geo_name = 'bank',
                       data = dat,
                       sp_name = 'binomial.cleaned',
                       num_rec = 5)

}