Removes or flags records with equal latitude and longitude coordinates, either exact or absolute. Equal coordinates can often indicate data entry errors.
Usage
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”.
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 -1.250152e+02 16.5107024
#> 2 b -1.568674e+02 -26.6848210
#> 3 c -9.969947e+01 38.1322648
#> 4 d 5.572711e+01 9.8132697
#> 5 e 9.193871e+00 17.4385804
#> 6 f -1.395258e+02 39.9476266
#> 7 g -1.770510e+02 79.9914020
#> 8 h 1.255112e+02 -0.1578602
#> 9 i -9.541907e+01 76.3327069
#> 10 j 3.367922e+01 -73.0876546
#> 11 a -5.654560e+01 25.5424587
#> 12 b 1.034017e+02 -15.2916044
#> 13 c 1.706004e+02 37.7802141
#> 14 d 7.746900e+01 59.4947840
#> 15 e 1.155425e+01 -52.0622383
#> 16 f -1.628486e+02 -27.9774943
#> 17 g 1.317719e+02 -69.3847529
#> 18 h -1.557847e+02 -66.7207713
#> 19 i 1.798826e+02 -87.9597923
#> 20 j 1.346125e+02 -11.2990942
#> 21 a 5.036259e+01 73.9479067
#> 22 b 5.801028e+01 -34.8889853
#> 23 c 1.633683e+02 7.6908886
#> 24 d -8.702308e+00 8.5953572
#> 25 e 1.450765e+02 -38.8861325
#> 26 f -5.793566e+01 -84.3309441
#> 27 g 7.553350e+00 -34.4638673
#> 28 h 1.655419e+02 87.8685331
#> 29 i -1.239924e+02 -87.8073279
#> 30 j 1.451027e+02 33.6190103
#> 31 a -8.698835e+01 81.7146691
#> 32 b 7.605328e+01 71.6364434
#> 33 c 1.578540e+02 -59.8794455
#> 34 d -4.927358e+01 48.1425269
#> 35 e 1.500054e+02 1.1264321
#> 36 f -1.458085e+02 31.5508521
#> 37 g 1.144513e+01 41.6072818
#> 38 h -1.071592e+01 -67.3192995
#> 39 i -8.347866e+01 45.9771894
#> 40 j -5.677434e+01 23.4556081
#> 41 a 7.301265e+01 -62.1845135
#> 42 b -2.562839e+01 -70.9650333
#> 43 c -1.792319e+02 -57.9929598
#> 44 d -1.681603e+02 -82.9519394
#> 45 e 1.300751e+02 43.7335896
#> 46 f -4.008375e+01 -69.7062953
#> 47 g -1.380936e+02 -76.7346562
#> 48 h 7.554539e+01 65.7162831
#> 49 i 1.107422e+02 -75.6923192
#> 50 j 8.500065e+01 -46.0559792
#> 51 a -1.142453e-04 -17.3773099
#> 52 b 1.268786e+02 -54.2010254
#> 53 c -1.225527e+02 -42.9289551
#> 54 d 1.048233e+02 85.4029013
#> 55 e 9.715245e+01 82.9667642
#> 56 f -1.235043e+02 24.1599272
#> 57 g -1.443151e+02 39.4469779
#> 58 h 1.523294e+02 -45.6105735
#> 59 i 4.823184e+01 -83.0546373
#> 60 j 1.427829e+02 -78.8052866
#> 61 a 3.123770e+01 16.0729688
#> 62 b -1.240330e+02 -55.0347257
#> 63 c -2.254044e+01 80.5297696
#> 64 d 4.693118e+01 -42.5427329
#> 65 e -1.671201e+02 14.8080905
#> 66 f 5.736481e+01 74.0790511
#> 67 g -7.731335e+01 -42.3106770
#> 68 h -1.681513e+02 76.8095423
#> 69 i 1.430056e+02 -83.7452140
#> 70 j -1.324160e+02 -1.6732216
#> 71 a 8.877285e+01 -45.2089160
#> 72 b -1.296550e+02 82.9614619
#> 73 c 1.828896e+01 75.1883831
#> 74 d -1.029534e+02 -77.7033793
#> 75 e -7.113583e+01 -87.1356997
#> 76 f -4.795112e+01 -84.3259270
#> 77 g -1.666452e+02 -12.0533811
#> 78 h -9.999581e+01 -64.3746813
#> 79 i 1.322121e+02 -30.7418524
#> 80 j 8.345801e+01 -20.0407014
#> 81 a -1.404176e+02 -55.5056636
#> 82 b 1.066546e+02 -57.5698122
#> 83 c -6.274493e+01 -47.9282950
#> 84 d -1.471845e+02 55.6837584
#> 85 e 3.292010e+01 28.0506239
#> 86 f 8.026185e+01 -30.7859889
#> 87 g 1.783868e+01 8.7783936
#> 88 h 1.091281e+02 -48.2582103
#> 89 i -1.622334e+02 -67.3427552
#> 90 j 4.743050e+01 -57.9662141
#> 91 a -1.332108e+02 34.1378799
#> 92 b 1.726172e+02 47.3521874
#> 93 c 4.400172e+01 73.4595140
#> 94 d -1.679497e+02 32.0349376
#> 95 e -1.065069e+02 23.2234019
#> 96 f -8.190947e+01 -40.8349416
#> 97 g -5.702437e+01 21.8037124
#> 98 h 1.785453e+02 -59.2295126
#> 99 i -1.218163e+02 -26.2874243
#> 100 j -7.424153e+01 -82.8997175
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