R/bdc_coordinates_precision.R
bdc_coordinates_precision.Rd
This function flags records with a coordinate precision below a specified number of decimal places. Coordinates with one, two, or three decimal places present a precision of~11.1 km, ~1.1 km, and ~111 m at the equator, respectively.
bdc_coordinates_precision(
data,
lat = "decimalLatitude",
lon = "decimalLongitude",
ndec = c(0, 1, 2)
)
data.frame. A data.frame containing geographic coordinates.
character string. The column with latitude in decimal degrees and WGS84. Default = "decimalLatitude".
character string. The column with longitude in decimal degrees and WGS84. Default = "decimalLongitude".
numeric. The minimum number of decimal places that the coordinates should have to be considered valid. Default = 2.
A data.frame with logical values indicating whether values are equal or higher than the specified minimum decimal number (ndec). Coordinates flagged as FALSE in .rou column are considered imprecise.
x <- data.frame(
lat = c(-21.34, 23.567, 16.798, -10.468),
lon = c(-55.38, -13.897, 30.8, 90.675)
)
bdc_coordinates_precision(
data = x,
lat = "lat",
lon = "lon",
ndec = 3
)
#> bdc_coordinates_precision:
#> Flagged 2 records
#> One column was added to the database.
#> lat lon .rou
#> 1 -21.340 -55.380 FALSE
#> 2 23.567 -13.897 TRUE
#> 3 16.798 30.800 FALSE
#> 4 -10.468 90.675 TRUE