将数据分成区域组

split the data into areas group

我有动物的位置数据,想知道每组点的归巢范围。 为此,我需要将数据分成区域组。 地点是这样的:

每个附近的点形成一个“搜索区域”(ARS)。我需要将数据框上的组分开。 我想到了根据经纬度的不同来分离数据。 如果纬度和经度的位置差异超过 1 度,则它们将属于不同的组(ARS1、ARS2、ARS3...)。

我的部分数据:

dput(head(ARS_mcpAA, 100))
structure(list(lon = c(-25.3106, -25.3536, -25.3753, -25.4123, 
-25.4445, -25.4745, -25.5087, -25.5394, -25.5558, -25.5853, -25.6008, 
-25.6122, -25.6245, -25.6513, -25.6137, -25.6156, -25.0399, -25.057, 
-25.0611, -25.0772, -25.0942, -25.1058, -25.1525, -25.1343, -25.2867, 
-25.3316, -25.3101, -25.346, -25.339, -25.3323, -25.3242, -25.3095, 
-29.1603, -29.1141, -29.0616, -29.0001, -29, -28.9444, -28.8759, 
-28.8156, -28.7648, -28.7036, -28.6464, -28.599, -28.5997, -28.4939, 
-28.4277, -28.3556, -28.286, -28.2096, -28.1324, -28.1, -27.9, 
-27.916, -27.8881, -27.8634, -27.8379, -27.8198, -27.8029, -27.7533, 
-27.7996, -27.844, -27.8933, -27.9441, -27.9914, -28.047, -28.0964, 
-28.1056, -28.2, -28.2624, -28.2586, -28.2485, -28.2558, -28.2533, 
-28.2534, -28.2934, -28.2977, -28.2285, -28.1912, -28.1556, -28.1207, 
-28.0847, -28.0311, -27.9999, -27.8999, -28.0039, -26.6698, -26.6115, 
-26.6087, -26.6469, -26.6833, -26.7237, -26.7557, -26.7865, -26.8144, 
-26.7555, -26.8862, -26.8486, -26.8508, -26.842), lat = c(-51.91975, 
-51.94013, -51.96147, -51.97386, -51.98679, -52.00712, -52.01164, 
-52.01192, -52.00469, -51.98914, -51.97125, -51.96493, -51.93765, 
-51.93972, -51.92433, -51.93924, -54.6441, -54.61579, -54.60819, 
-54.57326, -54.55675, -54.53017, -54.50315, -54.50552, -54.37702, 
-54.63709, -54.55168, -54.57639, -54.55191, -54.54964, -54.53068, 
-54.53434, -52.3707, -52.33346, -52.29154, -52.26176, -52.20485, 
-52.2329, -52.2451, -52.26278, -52.28739, -52.30114, -52.31802, 
-52.33401, -52.34195, -52.39641, -52.44113, -52.48227, -52.52482, 
-52.5623, -52.60991, -52.65369, -52.70683, -52.72654, -52.76817, 
-52.78996, -52.82452, -52.8552, -52.88773, -52.93046, -52.89812, 
-52.92588, -52.93636, -52.95839, -52.98223, -52.99873, -53.01708, 
-53.03776, -53.05409, -52.91672, -52.97992, -52.99798, -53.01391, 
-53.03261, -53.05399, -53.06071, -53.12244, -53.14963, -53.19108, 
-53.23538, -53.26971, -53.30717, -53.34671, -53.38771, -53.47304, 
-53.28979, -58.43823, -58.42534, -58.48206, -58.55891, -58.634, 
-58.70886, -58.7826, -58.84814, -58.9177, -58.97309, -58.90135, 
-58.89638, -58.87163, -58.84972), date = structure(c(1135987200, 
1136008800, 1136030400, 1136052000, 1136073600, 1136095200, 1136116800, 
1136138400, 1136160000, 1136181600, 1136203200, 1136224800, 1136246400, 
1136268000, 1136289600, 1136311200, 1137844800, 1137866400, 1137888000, 
1137909600, 1137931200, 1137952800, 1137974400, 1137996000, 1138017600, 
1138039200, 1138060800, 1138082400, 1138104000, 1138125600, 1138147200, 
1138168800, 1076328000, 1076349600, 1076371200, 1076392800, 1076414400, 
1076436000, 1076457600, 1076479200, 1076500800, 1076522400, 1076544000, 
1076565600, 1076587200, 1076608800, 1076630400, 1076652000, 1076673600, 
1076695200, 1076716800, 1076738400, 1076760000, 1076781600, 1076803200, 
1076824800, 1076846400, 1076868000, 1076889600, 1076911200, 1076932800, 
1076954400, 1076976000, 1076997600, 1077019200, 1077040800, 1077062400, 
1077084000, 1077105600, 1077127200, 1077148800, 1077170400, 1077192000, 
1077213600, 1077235200, 1077256800, 1077278400, 1077300000, 1077321600, 
1077343200, 1077364800, 1077386400, 1077408000, 1077429600, 1077451200, 
1077472800, 1079157600, 1079179200, 1079200800, 1079222400, 1079244000, 
1079265600, 1079287200, 1079308800, 1079330400, 1079352000, 1079373600, 
1079395200, 1079416800, 1079438400), class = c("POSIXct", "POSIXt"
), tzone = "UTC"), dist = c(0.0475851279287978, 0.0304349404467916, 
0.0390193810817139, 0.0346990619469767, 0.036239604026533, 0.0344973970032542, 
0.030701276846411, 0.0179229712938488, 0.0333474511769618, 0.0236707012992862, 
0.0130346614839044, 0.0299247121957797, 0.0268798232881078, 0.0406277257547101, 
0.0150305721780646, 0.00797985588841956, 0.0330736466087464, 
0.00863539228987056, 0.0384618629294038, 0.023697681321173, 0.029000972397492, 
0.0539534095308177, 0.0183536617599868, 0.199343948992687, 0.263917439552599, 
0.0880745031209411, 0.0435820387315739, 0.0254611547263713, 0.00707410064955216, 
0.0206177496347195, 0.0151487821292691, 0.021062167504796, 0.0593401853721378, 
0.0671828579326646, 0.068330801253897, 0.0569100878579556, 0.0622748946205438, 
0.0695779419069006, 0.0628384627437698, 0.0564472505973499, 0.0627256127909468, 
0.0596386988456339, 0.0500243950488163, 0.00797079669794453, 
0.118993830092154, 0.0798894135665022, 0.0830115028173822, 0.0815761147640628, 
0.0850982396997766, 0.0907003423367273, 0.0544651117689093, 0.20693926548628, 
0.0253866913952999, 0.0501145378108964, 0.0329377306443578, 0.0429493143134998, 
0.0356212352396748, 0.0366580264062267, 0.0654676477353514, 0.0564762392515655, 
0.0523638959589525, 0.0504015912447207, 0.0553711197286087, 0.0529682508678546, 
0.0579966378335868, 0.0526980312725228, 0.0226340981706792, 0.0958020297279769, 
0.150878351329809, 0.0633141374418086, 0.0206923560765798, 0.0175229820521552, 
0.018866372200289, 0.0213802338621453, 0.0405605522644842, 0.0618795838706084, 
0.0743500914592581, 0.0557619269753112, 0.0568317692844406, 0.0489546616779272, 
0.0519543222455989, 0.0666060928144003, 0.051521257748619, 0.131458011927764, 
0.210704918072641, 0.159760502315181, 0.059707973504381, 0.0567890693707851, 
0.0858205249343071, 0.083447397203271, 0.08506573693327, 0.0803840008957014, 
0.0724163766008751, 0.0749466717072901, 0.0808533369750392, 0.149094324506331, 
0.0379270470772485, 0.0248475853957656, 0.0236111859083836, 0.0232309298135001
), rel.angle = c(0.106513347035198, 0.334439915570008, -0.453905747296825, 
0.0587159774608601, 0.213735099400068, -0.464177180158973, -0.122281927295341, 
-0.424342114258423, -0.0698845746077619, -0.371748191325564, 
0.350650295049063, -0.641006711093813, 1.2242967834437, -2.83017329955871, 
-2.08604956048374, 2.66921593559173, 0.283390222061459, -0.0486494742037595, 
-0.0628263599018446, 0.36812029951223, -0.388517409595585, 0.63476849426147, 
-2.74655815919045, 2.57056484932375, 2.10035471937083, 3.06594981147763, 
2.42023065260177, -2.45214272845483, -0.96561305678503, 0.840383076071263, 
-1.41106893942014, 0.883530953328039, 0.0719694956610423, -0.00461442475790563, 
-0.222860804884139, 1.1180888738886, -2.03627742601714, 0.290984176880082, 
-0.108953175953151, -0.165922188166895, 0.230126074951815, -0.0659564740619957, 
-0.0383939565100851, -1.33337638642423, 1.18335643742019, -0.118739040263186, 
0.0755942344373712, -0.0302051793681526, 0.0926437762605385, 
-0.0965356730785566, -0.381069041046937, 0.673984987648684, -1.9929737285283, 
1.27231479544147, 0.257473004340075, -0.212232858892476, -0.102672758102347, 
-0.0538633633428984, 0.380526587672785, -3.04017520665256, 1.16847181825348, 
-0.349303088329756, 0.199725842196434, 0.0576719610123382, -0.178371920099785, 
0.0671772431743056, 0.796551827477172, -0.980921026978409, -1.31570776715771, 
2.77526627922122, 0.449860587075307, -0.93961230051551, 0.562599226036757, 
-0.137579029347167, -1.39967339887862, 1.33480478410293, 1.26595490922361, 
-0.463660607187198, -0.0558091080555709, 0.116692057337339, -0.0281053842880634, 
0.169696485860272, -0.284733931036345, 0.213900986884742, 2.79340587604884, 
-2.77615940242481, 2.98123184533383, -1.73906821939532, -0.510627903752983, 
0.00992797229725539, -0.043506204386766, 0.0854479709513727, 
-0.0298804936847927, 0.057865493684973, 1.19754776476618, -2.88888724541044, 
-2.50818258642514, 1.52803319844474, -0.470577908840144, 0.0303559881900255
), id = structure(c(61L, 61L, 61L, 61L, 61L, 61L, 61L, 61L, 61L, 
61L, 61L, 61L, 61L, 61L, 61L, 61L, 61L, 61L, 61L, 61L, 61L, 61L, 
61L, 61L, 61L, 61L, 61L, 61L, 61L, 61L, 61L, 61L, 62L, 62L, 62L, 
62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 
62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 
62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 
62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 
62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L, 62L
), .Label = c("102211.1", "10946.05", "111868.11", "111868.16", 
"111868.18", "111869.11", "111869.17", "111870.17", "111870.18", 
"111871.12", "112694.12", "112696.17", "112696.18", "112702.12", 
"112706.18", "112712.12", "112714.12", "112717.12", "112719.18", 
"112728.17", "120937.17", "120938.16", "120938.18", "120942.17", 
"120942.18", "120943.17", "120947.12", "120947.17", "121189.12", 
"121191.17", "121191.18", "121192.12", "121193.12", "121195.12", 
"121196.12", "121203.17", "121206.17", "123226.17", "171994.17", 
"171994.18", "171995.18", "171997.17", "172000.17", "172001.17", 
"172002.17", "172003.17", "172004.17", "172008.18", "194591.19", 
"194593.19", "194601.19", "194603.19", "20162.03", "20687.03", 
"21791.03", "21792.03", "21800.03", "21809.03", "21810.03", "24640.03", 
"24641.05", "24642.03", "26712.05", "27258.05", "27259.03", "27259.05", 
"27259.06", "27261.03", "27261.05", "27261.07", "33000.05", "33000.06", 
"33001.05", "33001.06", "37229.05", "37229.06", "37230.06", "37231.05", 
"37231.07", "37234.05", "37234.06", "37236.06", "37282.06", "37286.07", 
"37288.06", "37288.07", "42521.06", "42521.07", "42525.07", "50682.06", 
"50682.07", "50686.07", "50687.07", "60004.07", "60007.07", "7617.05", 
"7618.05", "81122.09", "81123.09", "81124.09", "81125.09", "81126.09", 
"84480.12", "84484.17", "84484.18", "84485.17", "84485.18", "84497.1", 
"87624.1", "87631.1", "87632.12", "87635.17", "87640.18", "87759.08", 
"87760.08", "87761.08", "87762.08", "87763.08", "87764.08", "87765.08", 
"87766.08", "87767.08", "87768.08", "87768.11", "87769.11", "87770.08", 
"87771.09", "87773.08", "87773.09", "87773.1", "87773.11", "87774.08", 
"87774.09", "87774.11", "87775.08", "87775.12", "87776.08", "87776.11", 
"87776.17", "87777.08", "87777.1", "87777.17", "87778.08", "87778.1", 
"87780.17", "87781.1", "87783.09", "87783.11", "88719.09", "88720.09", 
"88724.1", "88726.1", "88727.09", "96380.1"), class = "factor"), 
    sex = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L
    ), .Label = c("F", "I", "M"), class = "factor"), bmode = c(1.768, 
    1.777, 1.786, 1.797, 1.809, 1.819, 1.825, 1.834, 1.835, 1.825, 
    1.829, 1.814, 1.81, 1.788, 1.77, 1.756, 1.76, 1.769, 1.763, 
    1.779, 1.792, 1.803, 1.803, 1.804, 1.806, 1.796, 1.788, 1.778, 
    1.77, 1.766, 1.758, 1.759, 1.779, 1.803, 1.818, 1.83, 1.844, 
    1.853, 1.866, 1.88, 1.889, 1.899, 1.905, 1.911, 1.911, 1.917, 
    1.922, 1.923, 1.926, 1.929, 1.933, 1.934, 1.941, 1.954, 1.962, 
    1.973, 1.978, 1.978, 1.981, 1.978, 1.982, 1.977, 1.979, 1.978, 
    1.982, 1.983, 1.987, 1.987, 1.99, 1.992, 1.994, 1.998, 1.998, 
    1.998, 1.996, 1.988, 1.987, 1.984, 1.978, 1.972, 1.965, 1.947, 
    1.921, 1.9, 1.887, 1.838, 1.763, 1.784, 1.804, 1.83, 1.856, 
    1.88, 1.912, 1.936, 1.952, 1.969, 1.971, 1.976, 1.981, 1.985
    ), States = c("ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", 
    "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", 
    "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", 
    "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", 
    "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", 
    "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", 
    "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", 
    "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", 
    "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", 
    "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", 
    "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", "ARS", 
    "ARS", "ARS", "ARS"), P.social = structure(c(3L, 3L, 3L, 
    3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
    3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
    3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
    3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
    3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
    3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 
    3L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("AD", "ES", "MO"), class = "factor"), 
    speed = c(0.0987785338176652, 0.621163236272065, 0.46737443745321, 
    0.482094695260082, 0.439839811658523, 0.509970388443175, 
    0.400258161791518, 0.351348638812241, 0.230656581779234, 
    0.44406144445384, 0.376258406322213, 0.175463566571892, 0.525157981324833, 
    0.30956994892586, 0.516954379069446, 0.277352730350368, 0.416367881852949, 
    0.556545727857693, 0.147751328581044, 0.670857953470755, 
    0.35694622341867, 0.508752251417488, 0.710888179427656, 0.201360320173994, 
    2.89810577083966, 4.8492124392412, 1.60142237502354, 0.599967372995461, 
    0.460394474267271, 0.0836336076104151, 0.362445490445855, 
    0.172527331594047, 0.919427499086957, 0.867326290481948, 
    0.980047933052306, 0.891324498156241, 1.05541346394103, 0.819561335470701, 
    0.81204751654776, 0.760602818130664, 0.736393570349541, 0.741161553616298, 
    0.721640595774542, 0.61484542933434, 0.147466838647452, 1.56926241826836, 
    1.11863422778971, 1.11769668256639, 1.11499040114756, 1.10880704547075, 
    1.2410421896502, 0.890487781181087, 2.46042440828464, 0.407560324266723, 
    0.833517643041561, 0.490404133213112, 0.702144217680251, 
    0.604248048783353, 0.632452716895545, 0.968208036748787, 
    0.793255912054127, 0.71618980841691, 0.585715764363412, 0.700608908232262, 
    0.689945541839451, 0.693458578016448, 0.649056436701069, 
    0.397125608022642, 1.09778243260286, 2.64189448291469, 1.17297789253428, 
    0.353531274231773, 0.306545511435053, 0.347968617007825, 
    0.396554554448462, 0.464040987552268, 1.14597421973919, 0.922031078060161, 
    0.874024525933582, 0.912304007037293, 0.74578852475807, 0.801808706863773, 
    0.944555925968514, 0.835572380144741, 1.931951597507, 3.58945506674896, 
    1.19948819048543, 0.616017636297669, 1.05331778713592, 1.47412838675097, 
    1.43796159328843, 1.44363713236628, 1.40338553152299, 1.25240326511581, 
    1.31896626726273, 1.17339663305369, 1.82953053479454, 0.372832449214159, 
    0.459982870116384, 0.415481099997895), timestamp_adjusted = structure(c(1135980000, 
    1136001600, 1136023200, 1136044800, 1136066400, 1136088000, 
    1136109600, 1136131200, 1136152800, 1136174400, 1136196000, 
    1136217600, 1136239200, 1136260800, 1136282400, 1136304000, 
    1137837600, 1137859200, 1137880800, 1137902400, 1137924000, 
    1137945600, 1137967200, 1137988800, 1138010400, 1138032000, 
    1138053600, 1138075200, 1138096800, 1138118400, 1138140000, 
    1138161600, 1076320800, 1076342400, 1076364000, 1076385600, 
    1076407200, 1076428800, 1076450400, 1076472000, 1076493600, 
    1076515200, 1076536800, 1076558400, 1076580000, 1076601600, 
    1076623200, 1076644800, 1076666400, 1076688000, 1076709600, 
    1076731200, 1076752800, 1076774400, 1076796000, 1076817600, 
    1076839200, 1076860800, 1076882400, 1076904000, 1076925600, 
    1076947200, 1076968800, 1076990400, 1077012000, 1077033600, 
    1077055200, 1077076800, 1077098400, 1077120000, 1077141600, 
    1077163200, 1077184800, 1077206400, 1077228000, 1077249600, 
    1077271200, 1077292800, 1077314400, 1077336000, 1077357600, 
    1077379200, 1077400800, 1077422400, 1077444000, 1077465600, 
    1079150400, 1079172000, 1079193600, 1079215200, 1079236800, 
    1079258400, 1079280000, 1079301600, 1079323200, 1079344800, 
    1079366400, 1079388000, 1079409600, 1079431200), class = c("POSIXct", 
    "POSIXt"), tzone = "UTC"), TOD = c("22:00:00", "04:00:00", 
    "10:00:00", "16:00:00", "22:00:00", "04:00:00", "10:00:00", 
    "16:00:00", "22:00:00", "04:00:00", "10:00:00", "16:00:00", 
    "22:00:00", "04:00:00", "10:00:00", "16:00:00", "10:00:00", 
    "16:00:00", "22:00:00", "04:00:00", "10:00:00", "16:00:00", 
    "22:00:00", "04:00:00", "10:00:00", "16:00:00", "22:00:00", 
    "04:00:00", "10:00:00", "16:00:00", "22:00:00", "04:00:00", 
    "10:00:00", "16:00:00", "22:00:00", "04:00:00", "10:00:00", 
    "16:00:00", "22:00:00", "04:00:00", "10:00:00", "16:00:00", 
    "22:00:00", "04:00:00", "10:00:00", "16:00:00", "22:00:00", 
    "04:00:00", "10:00:00", "16:00:00", "22:00:00", "04:00:00", 
    "10:00:00", "16:00:00", "22:00:00", "04:00:00", "10:00:00", 
    "16:00:00", "22:00:00", "04:00:00", "10:00:00", "16:00:00", 
    "22:00:00", "04:00:00", "10:00:00", "16:00:00", "22:00:00", 
    "04:00:00", "10:00:00", "16:00:00", "22:00:00", "04:00:00", 
    "10:00:00", "16:00:00", "22:00:00", "04:00:00", "10:00:00", 
    "16:00:00", "22:00:00", "04:00:00", "10:00:00", "16:00:00", 
    "22:00:00", "04:00:00", "10:00:00", "16:00:00", "04:00:00", 
    "10:00:00", "16:00:00", "22:00:00", "04:00:00", "10:00:00", 
    "16:00:00", "22:00:00", "04:00:00", "10:00:00", "16:00:00", 
    "22:00:00", "04:00:00", "10:00:00"), YMD = c("2005,12,30", 
    "2005,12,31", "2005,12,31", "2005,12,31", "2005,12,31", "2006,01,01", 
    "2006,01,01", "2006,01,01", "2006,01,01", "2006,01,02", "2006,01,02", 
    "2006,01,02", "2006,01,02", "2006,01,03", "2006,01,03", "2006,01,03", 
    "2006,01,21", "2006,01,21", "2006,01,21", "2006,01,22", "2006,01,22", 
    "2006,01,22", "2006,01,22", "2006,01,23", "2006,01,23", "2006,01,23", 
    "2006,01,23", "2006,01,24", "2006,01,24", "2006,01,24", "2006,01,24", 
    "2006,01,25", "2004,02,09", "2004,02,09", "2004,02,09", "2004,02,10", 
    "2004,02,10", "2004,02,10", "2004,02,10", "2004,02,11", "2004,02,11", 
    "2004,02,11", "2004,02,11", "2004,02,12", "2004,02,12", "2004,02,12", 
    "2004,02,12", "2004,02,13", "2004,02,13", "2004,02,13", "2004,02,13", 
    "2004,02,14", "2004,02,14", "2004,02,14", "2004,02,14", "2004,02,15", 
    "2004,02,15", "2004,02,15", "2004,02,15", "2004,02,16", "2004,02,16", 
    "2004,02,16", "2004,02,16", "2004,02,17", "2004,02,17", "2004,02,17", 
    "2004,02,17", "2004,02,18", "2004,02,18", "2004,02,18", "2004,02,18", 
    "2004,02,19", "2004,02,19", "2004,02,19", "2004,02,19", "2004,02,20", 
    "2004,02,20", "2004,02,20", "2004,02,20", "2004,02,21", "2004,02,21", 
    "2004,02,21", "2004,02,21", "2004,02,22", "2004,02,22", "2004,02,22", 
    "2004,03,13", "2004,03,13", "2004,03,13", "2004,03,13", "2004,03,14", 
    "2004,03,14", "2004,03,14", "2004,03,14", "2004,03,15", "2004,03,15", 
    "2004,03,15", "2004,03,15", "2004,03,16", "2004,03,16"), 
    area = c("AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", 
    "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", 
    "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", 
    "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", 
    "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", 
    "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", 
    "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", 
    "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", 
    "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", 
    "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", "AA", 
    "AA", "AA")), row.names = c(13038L, 13039L, 13040L, 13041L, 
13042L, 13043L, 13044L, 13045L, 13046L, 13047L, 13048L, 13049L, 
13050L, 13051L, 13052L, 13053L, 13124L, 13125L, 13126L, 13127L, 
13128L, 13129L, 13130L, 13131L, 13132L, 13133L, 13134L, 13135L, 
13136L, 13137L, 13138L, 13139L, 13619L, 13620L, 13621L, 13622L, 
13623L, 13624L, 13625L, 13626L, 13627L, 13628L, 13629L, 13630L, 
13631L, 13632L, 13633L, 13634L, 13635L, 13636L, 13637L, 13638L, 
13639L, 13640L, 13641L, 13642L, 13643L, 13644L, 13645L, 13646L, 
13647L, 13648L, 13649L, 13650L, 13651L, 13652L, 13653L, 13654L, 
13655L, 13656L, 13657L, 13658L, 13659L, 13660L, 13661L, 13662L, 
13663L, 13664L, 13665L, 13666L, 13667L, 13668L, 13669L, 13670L, 
13671L, 13672L, 13750L, 13751L, 13752L, 13753L, 13754L, 13755L, 
13756L, 13757L, 13758L, 13759L, 13760L, 13761L, 13762L, 13763L
), class = "data.frame")

那么,我将应用函数 mcp()

我怀疑这是一个集群问题。 KNN(一种非常常见的聚类工具)的一个常见问题是它通常需要先验知道聚类的数量。这可以通过人在回路中实现,但通常您可能不想依赖它。

另一个很好的聚类工具是 dbscan。我将演示使用 hdbscan:

library(dbscan)
cl <- hdbscan(dat[,1:2], minPts = 5)
plot(lat ~ lon, data=dat, col = cl$cluster + 1, pch = 16)

您可能更喜欢稍微大一点的分组,也许

cl <- hdbscan(dat[,1:2], minPts = 10)
plot(lat ~ lon, data=dat, col = cl$cluster + 1, pch = 16)

这显示了一个分层DBSCAN,使用dbscan本身可能也是合理的。

cl <- dbscan(dat[,1:2], eps=0.5) # play with eps