Removes or flags records with equal latitude and longitude coordinates, either exact or absolute. Equal coordinates can often indicate data entry errors.

cc_equ(
  x,
  lon = "decimalLongitude",
  lat = "decimalLatitude",
  test = "absolute",
  value = "clean",
  verbose = TRUE
)

Arguments

x

data.frame. Containing geographical coordinates and species names.

lon

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

lat

character string. The column with the latitude coordinates. Default = “decimalLatitude”.

test

character string. Defines if coordinates are compared exactly (“identical”) or on the absolute scale (i.e. -1 = 1, “absolute”). Default is to “absolute”.

value

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 (“flagged”), with TRUE = test passed and FALSE = test failed/potentially problematic . Default = “clean”.

See also

Other Coordinates: cc_aohi(), cc_cap(), cc_cen(), cc_coun(), cc_dupl(), cc_gbif(), cc_inst(), cc_iucn(), cc_outl(), cc_sea(), cc_urb(), cc_val(), cc_zero()

Examples


x <- data.frame(species = letters[1:10], 
                decimalLongitude = runif(100, -180, 180), 
                decimalLatitude = runif(100, -90,90))

cc_equ(x)
#> Testing equal lat/lon
#> Removed 0 records.
#>     species decimalLongitude decimalLatitude
#> 1         a      -145.763476      -69.693598
#> 2         b       108.173940       74.667802
#> 3         c       118.988081       24.939476
#> 4         d        11.035273      -38.036311
#> 5         e       174.278477       74.336978
#> 6         f       162.326225       89.167580
#> 7         g       -35.493379       51.347751
#> 8         h        75.210913      -29.064379
#> 9         i      -106.439931       65.158406
#> 10        j      -113.191589       74.783930
#> 11        a       -85.886662      -30.487019
#> 12        b       -47.045671       19.091322
#> 13        c        36.381447      -46.990377
#> 14        d      -165.002130      -43.200758
#> 15        e      -141.648428       66.222776
#> 16        f      -128.811187       86.404152
#> 17        g        59.836291      -79.235255
#> 18        h       -87.480411      -45.731704
#> 19        i       -17.091247      -47.552791
#> 20        j        58.488822       79.636022
#> 21        a       -69.707792       83.033766
#> 22        b      -162.726845      -70.431241
#> 23        c        40.590415       29.653785
#> 24        d       -99.821238       60.541879
#> 25        e       113.814120      -89.708826
#> 26        f        -8.469770      -81.583691
#> 27        g       -53.679441      -50.165953
#> 28        h        58.788912       63.546299
#> 29        i      -106.122716      -80.107263
#> 30        j       113.678730      -71.426826
#> 31        a      -135.962298       39.071083
#> 32        b        -2.330921        8.684365
#> 33        c       120.074049      -43.223601
#> 34        d      -160.319667       -1.312353
#> 35        e       170.735199       25.167363
#> 36        f      -133.078224      -28.972267
#> 37        g        19.152715      -20.857897
#> 38        h       -55.710648       24.347664
#> 39        i        88.858221       30.169225
#> 40        j      -163.901085       31.265683
#> 41        a        96.301358       74.156630
#> 42        b         8.297715      -13.170301
#> 43        c         9.387631       77.372127
#> 44        d      -177.295209       42.422162
#> 45        e      -112.669620      -61.782425
#> 46        f        73.639143       60.070511
#> 47        g       -25.252742       62.990552
#> 48        h       155.519281       23.215616
#> 49        i      -154.083771      -19.384240
#> 50        j       -12.226917       19.178416
#> 51        a       -18.581917      -29.284670
#> 52        b        44.933071       54.675904
#> 53        c        47.716302      -72.042319
#> 54        d       -36.138549      -69.386158
#> 55        e       101.095577      -20.428270
#> 56        f       -49.682654       40.111302
#> 57        g      -170.887400       76.719626
#> 58        h      -102.148906       40.755177
#> 59        i       150.819295      -44.886924
#> 60        j       161.601534      -19.261348
#> 61        a        89.867145       59.127931
#> 62        b        96.169740      -18.153203
#> 63        c       144.940436      -56.742135
#> 64        d       -68.655027       82.216997
#> 65        e      -159.819608       -2.363761
#> 66        f         1.719636      -79.093388
#> 67        g       -73.047663      -34.732172
#> 68        h       -16.685392      -14.825898
#> 69        i       137.033942      -26.010382
#> 70        j      -127.320348      -15.605898
#> 71        a        85.137903      -73.925882
#> 72        b      -178.920339      -25.091960
#> 73        c       172.432076       43.926972
#> 74        d       -30.025073      -48.311966
#> 75        e        44.831525      -25.446379
#> 76        f        43.028795      -80.354417
#> 77        g       100.623069       83.979062
#> 78        h       -34.122191       -7.114932
#> 79        i      -146.646953      -29.970686
#> 80        j       -26.221187       -3.705819
#> 81        a        27.663868      -61.336234
#> 82        b        64.078492        3.739041
#> 83        c        87.972167       88.938649
#> 84        d      -117.540600       16.346493
#> 85        e        11.487076       55.580814
#> 86        f       161.771507      -38.651988
#> 87        g       -26.113325        6.861238
#> 88        h      -158.579831       -9.315754
#> 89        i       -10.958197      -47.286588
#> 90        j         8.412303       15.678103
#> 91        a       124.485145      -80.494820
#> 92        b       129.757556      -16.450876
#> 93        c       -70.768714      -31.879133
#> 94        d      -167.784574      -89.915095
#> 95        e        45.217592       -2.624312
#> 96        f       139.655711       56.370410
#> 97        g      -169.597840      -14.827897
#> 98        h        52.398506      -13.586572
#> 99        i       -16.700028       82.546377
#> 100       j       133.012401      -65.323447
cc_equ(x, value = "flagged")
#> Testing equal lat/lon
#> Flagged 0 records.
#>   [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
#>  [16] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
#>  [31] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
#>  [46] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
#>  [61] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
#>  [76] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
#>  [91] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE