cc_cap.RdRemoves or flags records within a certain radius around country capitals. Poorly geo-referenced occurrence records in biological databases are often erroneously geo-referenced to capitals.
cc_cap(x, lon = "decimallongitude", lat = "decimallatitude", species = "species", buffer = 10000, geod = TRUE, ref = NULL, verify = FALSE, value = "clean", verbose = TRUE)
| 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”. |
| species | character string. The column with the species identity. Only required if verify = TRUE. |
| buffer | The buffer around each capital coordinate (the center of the city), where records should be flagged as problematic. Units depend on geod. Default = 10 kilometers. |
| geod | logical. If TRUE the radius around each capital is calculated based on a sphere, buffer is in meters and independent of latitude. If FALSE the radius is calculated assuming planar coordinates and varies slightly with latitude, in this case buffer is in degrees. Default = TRUE. See https://seethedatablog.wordpress.com/ for detail and credits. |
| ref | SpatialPointsDataFrame. Providing the geographic gazetteer. Can
be any SpatialPointsDataFrame, but the structure must be identical to
|
| verify | logical. If TRUE records are only flagged if they are the only record in a given species flagged close to a given reference. If FALSE, the distance is the only criterion |
| 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. |
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 https://ropensci.github.io/CoordinateCleaner/ for more details and tutorials.
Other Coordinates: cc_cen,
cc_coun, cc_dupl,
cc_equ, cc_gbif,
cc_inst, cc_iucn,
cc_outl, cc_sea,
cc_urb, cc_val,
cc_zero
x <- data.frame(species = letters[1:10], decimallongitude = runif(100, -180, 180), decimallatitude = runif(100, -90,90)) cc_cap(x)#>#>#> species decimallongitude decimallatitude #> 1 a -150.9299505 55.02240553 #> 2 b 120.3598934 56.52923581 #> 3 c 36.2739190 -17.29601964 #> 4 d -123.4049611 -50.68241843 #> 5 e -177.3362012 -14.69494758 #> 6 f -12.0983410 30.39673460 #> 7 g -0.8001401 1.37705076 #> 8 h -75.6837919 28.86467517 #> 9 i 83.8375153 2.12243648 #> 10 j 98.1077440 60.39943866 #> 11 a 134.8562379 37.58060904 #> 12 b -117.0213743 67.35706936 #> 13 c -167.6731202 -87.93368317 #> 14 d -64.6611369 69.88492223 #> 15 e -35.1618342 89.34244540 #> 16 f -109.5588595 0.03447016 #> 17 g -34.7262777 -25.38593561 #> 18 h -157.0818754 49.48434401 #> 19 i -40.0675273 15.20554516 #> 20 j 171.1972207 24.11574678 #> 21 a -75.6387737 64.55990786 #> 22 b 64.2169539 12.04098097 #> 23 c 84.7150556 -44.46053652 #> 24 d -109.4555761 75.38457862 #> 25 e 172.9942829 66.12303687 #> 26 f 86.9477505 -45.26303456 #> 27 g -161.4793405 -17.48138187 #> 28 h 10.8764869 48.53343168 #> 29 i 70.4965964 -68.49263258 #> 30 j 67.8801612 -54.95490690 #> 31 a -168.7570829 -60.37753532 #> 32 b -98.7974876 29.37718463 #> 33 c -71.7009098 64.18350081 #> 34 d 49.1276214 76.77836071 #> 35 e -7.5511621 9.42796703 #> 36 f -24.4183471 13.87182499 #> 37 g 74.3161816 33.74059421 #> 38 h 161.4875675 -45.95071867 #> 39 i -115.0780435 -81.96891150 #> 40 j -101.9160445 73.77382020 #> 41 a 64.8586503 -77.27738054 #> 42 b -0.4155802 89.44046522 #> 43 c 51.0045654 20.13343514 #> 44 d 57.7023657 -58.93940777 #> 45 e -145.4313031 73.69937373 #> 46 f 95.6160590 -83.25878996 #> 47 g 97.0829295 16.83968226 #> 48 h 176.6564324 -47.34404013 #> 49 i 169.3875250 73.13350801 #> 50 j -39.8942062 57.39713713 #> 51 a -13.9728727 35.96928430 #> 52 b -66.5129691 -50.39994074 #> 53 c -117.1166782 41.03836890 #> 54 d 11.3664747 -50.92479679 #> 55 e -2.2906742 -7.87856431 #> 56 f 100.5511053 -30.09604351 #> 57 g -106.4957966 12.30348034 #> 58 h 76.8230204 -44.60296953 #> 59 i -156.5221998 -6.47755799 #> 60 j -52.4855524 75.17889124 #> 61 a 117.0717916 85.11195922 #> 62 b -81.4254317 57.43484039 #> 63 c 25.2161824 72.52628367 #> 64 d -59.1411310 14.64588792 #> 65 e 34.6546040 49.14152660 #> 66 f -111.0535087 89.12214476 #> 67 g 161.1950176 37.97482495 #> 68 h 15.2929471 -51.31033278 #> 69 i 16.0572216 -37.48362661 #> 70 j -79.7050246 39.91675128 #> 71 a -19.1871111 65.99082660 #> 72 b -46.2559736 -47.07844083 #> 73 c -169.8980492 -89.19066455 #> 74 d -12.2446113 79.83296356 #> 75 e -39.5887006 -11.13530392 #> 76 f -172.7765216 45.10859908 #> 77 g -44.2904660 30.20683760 #> 78 h 21.5686224 -16.56482373 #> 79 i 128.5500910 -26.77521331 #> 80 j -41.4685040 42.85648107 #> 81 a 10.0501328 29.57138871 #> 82 b 36.2295085 -74.65955397 #> 83 c -85.9063110 64.10378820 #> 84 d -75.5819418 -76.14300210 #> 85 e -7.1729374 63.51206461 #> 86 f 151.2019966 -70.85754704 #> 87 g -35.7407335 -2.73549177 #> 88 h -103.2578240 -45.50056013 #> 89 i 61.8360537 33.58245791 #> 90 j -158.8989200 -60.54782433 #> 91 a 178.9448887 81.50846397 #> 92 b -126.3472318 -32.06618080 #> 93 c 6.6803888 -24.92385898 #> 94 d 124.6032197 69.79021515 #> 95 e 78.5771007 59.04259520 #> 96 f -93.1269528 -71.88183761 #> 97 g 16.9356126 73.08928400 #> 98 h 120.5286535 49.09146560 #> 99 i -169.9358308 -20.99327931 #> 100 j -11.0216521 89.93744229cc_cap(x, value = "flagged")#>#>#> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #> TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 #> TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 #> TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 #> TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 #> TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 #> TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE #> 97 98 99 100 #> TRUE TRUE TRUE TRUE