
Last chance! 50% off unlimited learning
Sale ends in
Compares stated country name in an occurrence record with record's coordinates using
rnaturalearth data. The prefix, jbd_ is meant
to distinguish this function from the original bdc::bdc_coordinates_country_inconsistent()
.
This functions will preferably use the countryCode and country_suggested columns
generated by bdc::bdc_country_standardized()
; please run it on your dataset prior to running
this function.
jbd_coordCountryInconsistent(
data = NULL,
lon = "decimalLongitude",
lat = "decimalLatitude",
scale = 50,
pointBuffer = 0.01,
stepSize = 1e+06,
mc.cores = 1
)
The input occurrence data with a new column, .coordinates_country_inconsistent
A data frame or tibble. Occurrence records as input.
Character. The name of the column to use as longitude. Default = "decimalLongitude".
Character. The name of the column to use as latitude. Default = "decimalLatitude".
Numeric or character. To be passed to rnaturalearth::ne_countries()
's scale.
Scale of map to return, one of 110, 50, 10 or "small", "medium", "large".
Smaller values return higher-resolution maps.
Numeric. Amount to buffer points, in decimal degrees. If the point is outside of a country, but within this point buffer, it will not be flagged. Default = 0.01.
Numeric. The number of occurrences to process in each chunk. Default = 1000000.
Numeric. If > 1, the st_intersects function will run in parallel using mclapply using the number of cores specified. If = 1 then it will be run using a serial loop. NOTE: Windows machines must use a value of 1 (see ?parallel::mclapply). Additionally, be aware that each thread can use large chunks of memory. Default = 1.
if(requireNamespace("rnaturalearthdata")){
beesRaw_out <- jbd_coordCountryInconsistent(
data = BeeBDC::beesRaw,
lon = "decimalLongitude",
lat = "decimalLatitude",
scale = 50,
pointBuffer = 0.01)
} # END if require
Run the code above in your browser using DataLab