This function flags records missing latitude or longitude coordinates.

bdc_coordinates_empty(data, lat = "decimalLatitude", lon = "decimalLongitude")

Arguments

data

data.frame. Containing geographical coordinates.

lat

character string. The column name with latitude in decimal degrees and WGS84. Default = "decimalLatitude".

lon

character string. The column with longitude in decimal degrees and WGS84. Default = "decimalLongitude".

Value

A data.frame containing the column ".coordinates_empty". Compliant (TRUE) if 'lat' and 'lon' are not empty; otherwise "FALSE".

Details

This test identifies records missing geographic coordinates (i.e., empty or not applicable NA longitude or latitude)

Examples

x <- data.frame(
  decimalLatitude = c(19.9358, -13.016667, NA, ""),
  decimalLongitude = c(-40.6003, -39.6, -20.5243, NA)
)

bdc_coordinates_empty(
  data = x,
  lat = "decimalLatitude",
  lon = "decimalLongitude"
)
#> 
#> bdc_coordinates_empty:
#> Flagged 2 records.
#> One column was added to the database.
#>   decimalLatitude decimalLongitude .coordinates_empty
#> 1         19.9358         -40.6003               TRUE
#> 2      -13.016667         -39.6000               TRUE
#> 3            <NA>         -20.5243              FALSE
#> 4                               NA              FALSE