Learn R Programming

CoordinateCleaner (version 1.0-7)

cc_cen: Flag Coordinates in Vicinity of Country and Province Centroids

Description

Flags records within a radius around the geographic centroids of political countries and provinces. Poorly geo-referenced occurrence records in biological databases are often erroneously geo-referenced to centroids.

Usage

cc_cen(x, lon = "decimallongitude", lat = "decimallatitude", 
       buffer = 0.1, test = "both", ref = NULL, value = "clean", verbose = TRUE)

Arguments

x

a data.frame. Containing geographical coordinates and species names.

lon

a character string. The column with the longitude coordinates. Default = “decimallongitude”.

lat

a character string. The column with the longitude coordinates. Default = “decimallatitude”.

buffer

numerical. The buffer around each province or country centroid, where records should be flagged as problematic, in decimal degrees. Default = 0.1.

test

a character string. Specifying the details of the test. One of c(“both”, “country”, “provinces”). If both tests for country and province centroids.

ref

a SpatialPointsDataframe. Providing the geographic gazetteer. Can be any SpatialPointsDataframe, but the structure must be identical to centroids. Default = centroids

value

a character string. Defining the output value. See value.

verbose

logical. If TRUE reports the name of the test and the number of records flagged.

Value

Depending on the ‘value’ argument, either a data.frame containing the records considered correct by the test (“clean”) or a logical vector, with TRUE = test passed and FALSE = test failed/potentially problematic (“flags”). Default = “clean”.

Details

Note: the buffer radius is in degrees, thus will differ slightly between different latitudes.

Examples

Run this code
# NOT RUN {
x <- data.frame(species = letters[1:10], 
                decimallongitude = runif(100, -180, 180), 
                decimallatitude = runif(100, -90,90))
                
cc_cen(x)
cc_cen(x, value = "flags")
# }

Run the code above in your browser using DataLab