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 74.5007393 -25.2071779
#> 2 b -20.8127087 -54.1824765
#> 3 c 63.9714683 40.7313571
#> 4 d 72.2573948 -59.7361589
#> 5 e -155.3736890 -49.2333607
#> 6 f 165.0612674 62.1972099
#> 7 g -91.9859324 -27.7463518
#> 8 h 153.4620005 -77.8824309
#> 9 i 0.9889476 -85.1364983
#> 10 j 156.7861711 -68.7519775
#> 11 a -22.0321323 -87.5348337
#> 12 b -53.8248468 42.4312863
#> 13 c -8.4585282 76.3129378
#> 14 d 167.8174290 86.7943078
#> 15 e -73.0217063 -17.0513633
#> 16 f -75.3666090 -41.4549660
#> 17 g 129.5000091 -2.1080429
#> 18 h -110.4074399 -80.8087585
#> 19 i 111.2790137 -89.5541706
#> 20 j -48.4248555 -0.7497585
#> 21 a -89.0281249 -46.1175690
#> 22 b 128.1891650 -43.9651334
#> 23 c -133.1912270 9.4173799
#> 24 d 105.0867578 -44.7160269
#> 25 e -51.8754563 23.1210300
#> 26 f 167.1637816 -33.0992088
#> 27 g -137.2740447 76.4136706
#> 28 h -15.0621662 73.1685060
#> 29 i 8.5141572 -73.4454368
#> 30 j 121.3422213 42.8031274
#> 31 a -167.9385465 12.5532972
#> 32 b -164.4017618 35.3679436
#> 33 c 105.1570600 36.1381506
#> 34 d -107.0283727 -82.8106821
#> 35 e -155.2336387 -12.3259673
#> 36 f 131.1987864 56.5616458
#> 37 g -152.2476506 11.9855299
#> 38 h -24.8387693 15.8844911
#> 39 i 170.5041209 68.4556258
#> 40 j 25.5446438 39.4772334
#> 41 a 91.5863924 78.5572008
#> 42 b -92.7164415 -12.7023095
#> 43 c 45.7768317 -38.4862814
#> 44 d -119.3707429 48.7157730
#> 45 e -19.8757321 20.9697546
#> 46 f -120.7169157 -61.3305454
#> 47 g -137.4203581 -17.7123590
#> 48 h -47.7128194 -89.7036320
#> 49 i 160.7612058 -14.7661136
#> 50 j 135.1478748 47.5081849
#> 51 a -86.3787915 53.0059800
#> 52 b 56.6274374 -46.3343363
#> 53 c -136.1287348 46.6507717
#> 54 d -65.2147060 -84.7612524
#> 55 e 44.3019709 -11.2786591
#> 56 f -19.0809251 5.4737077
#> 57 g 74.9856405 -12.6303568
#> 58 h 140.4104400 55.6734526
#> 59 i -142.4496586 76.0616313
#> 60 j 46.9482188 31.5042252
#> 61 a 122.9612078 -73.0857253
#> 62 b -48.8655247 -54.4566029
#> 63 c 44.2522001 -4.4018774
#> 64 d -14.1308949 38.5868942
#> 65 e -121.1715794 6.8542712
#> 66 f 4.9920703 67.5689419
#> 67 g -128.4240822 -37.1546257
#> 68 h 54.1075323 -49.5422230
#> 69 i -124.0939688 34.3652096
#> 70 j 2.9915504 -33.7807071
#> 71 a -149.0866400 -3.0063279
#> 72 b 1.0895987 -68.0766048
#> 73 c -166.1141220 34.2013023
#> 74 d 116.6518358 -33.1683472
#> 75 e -77.0451933 56.9137829
#> 76 f -91.1696878 8.2647789
#> 77 g -36.7223061 80.5170931
#> 78 h 47.5534351 -83.0652468
#> 79 i 161.4883843 26.5758978
#> 80 j -57.5570722 -75.6685780
#> 81 a 45.8517548 -12.0724615
#> 82 b 116.9695422 46.9607641
#> 83 c -127.7584643 -37.1234088
#> 84 d 168.1700870 -70.6802593
#> 85 e -149.0259637 -76.8610005
#> 86 f -93.4339555 -25.8633761
#> 87 g 49.9981439 12.8809517
#> 88 h 1.2222294 32.0378506
#> 89 i -89.8116265 34.3294383
#> 90 j 172.4521588 -22.7860522
#> 91 a 56.3686495 -72.3639502
#> 92 b -147.6543955 -72.1782526
#> 93 c 46.9954550 49.4642850
#> 94 d 135.6363582 -62.7307994
#> 95 e 154.9013529 -18.9708156
#> 96 f -28.9850931 78.2997126
#> 97 g -1.5984469 43.1261215
#> 98 h -53.0263109 24.4202621
#> 99 i -90.4554479 -29.1204269
#> 100 j 165.1420436 83.2349348
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