У меня есть небольшой фрейм данных, который содержит точки двух полигонов по обе стороны от моей учебной системы и изображен ниже (Восток - синим, Запад - красным).Вот датафрейм.
structure(list(Shore = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L), .Label = c("East", "West"), class = "factor"), Lat = c(72.45604629,
72.44350398, 72.41516226, 72.36734761, 72.33600228, 72.31760236,
72.29050994, 72.26066187, 72.2680832, 72.47144353, 72.45604629,
72.45604629, 72.44816356, 72.37238665, 72.24127983, 72.26066187,
72.29050994, 72.31760236, 72.33600228, 72.36734761, 72.41516226,
72.44350398, 72.45604629, 72.45604629), Long = c(-80.89019727,
-80.91753044, -80.9496172, -81.0363703, -81.1243118, -81.15639857,
-81.16947095, -81.27702103, -81.33465836, -80.90326966, -80.89019727,
-80.89019727, -80.84860332, -80.94367521, -81.28474562, -81.27702103,
-81.16947095, -81.15639857, -81.1243118, -81.0363703, -80.9496172,
-80.91753044, -80.89019727, -80.89019727)), class = "data.frame", row.names = c(NA,
-24L))
У меня также есть данные о движениях животных, которые обнаруживаются в каждой из точек, показанных на карте.Что я хочу знать, так это то, когда и где внутри системы животные переходят из красного в синий и наоборот.Ниже небольшой раздел моих данных.Все данные должны попадать в один из двух полигонов (красный или синий).Столбец идентификатора - это идентификатор отдельного животного, а столбец «Станция» указывает, какой получатель («А» - самый северный и 1 - самый западный).Я думаю, в конце концов я бы искал новый фрейм данных со столбцами, показывающими дату / время, когда произошли эти события, станции, на которых произошло движение, и человека, который переехал.
structure(list(DateTime = structure(c(1503006715, 1503006880,
1503007037, 1503007108, 1503007185, 1503007255, 1503007331, 1503007399,
1503007554, 1503007633, 1503007709, 1503007775, 1503007845, 1503007987,
1503008057, 1503008132, 1503008199, 1503008269, 1503008392, 1503008412,
1503008544, 1503008620, 1503009148, 1503009217, 1503009291, 1503009356,
1503009376, 1503009421, 1503009488, 1503009508, 1503009558, 1503009578,
1503009634, 1503009702, 1503009722, 1503009774, 1503009854, 1503009875,
1503009932, 1503010003, 1503010023, 1503010081, 1503010101, 1503010153,
1503010234, 1503010254, 1503010312, 1503010332, 1503010383, 1503010463,
1503010483, 1503010538, 1503015897, 1503015963, 1503016024, 1503016873,
1503017027, 1503017229, 1503022094, 1503022380, 1503022393, 1503022476,
1503022559, 1503022641, 1503022721, 1503022785, 1503022798, 1503022855,
1503022868, 1503022931, 1503022944, 1503023000, 1503023013, 1503023073,
1503023086, 1503023155, 1503023168, 1503023235, 1503023313, 1503023383,
1503023397, 1503023461, 1503023474, 1503023533, 1503023612, 1503023625,
1503023686, 1503023816, 1503024252, 1502754012, 1502754224, 1502754364,
1502754444, 1502754588, 1502754661, 1502754742, 1502754822, 1502758872,
1502758944, 1502758971), class = c("POSIXct", "POSIXt"), tzone = "America/New_York"),
ID = c(1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L,
1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L,
1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L,
1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L,
1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L,
1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L,
1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L,
1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L,
1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L,
1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L, 1657L,
1658L, 1658L, 1658L, 1658L, 1658L, 1658L, 1658L, 1658L, 1658L,
1658L, 1658L), Station = c("TRD1", "TRD1", "TRD1", "TRD1",
"TRD1", "TRD1", "TRD1", "TRD1", "TRD1", "TRD1", "TRD1", "TRD1",
"TRD1", "TRD1", "TRD1", "TRD1", "TRD1", "TRD1", "TRD2", "TRD1",
"TRD2", "TRD2", "TRD2", "TRD2", "TRD2", "TRD2", "TRD1", "TRD2",
"TRD2", "TRD1", "TRD2", "TRD1", "TRD2", "TRD2", "TRD1", "TRD2",
"TRD2", "TRD1", "TRD2", "TRD2", "TRD1", "TRD2", "TRD1", "TRD2",
"TRD2", "TRD1", "TRD2", "TRD1", "TRD2", "TRD2", "TRD1", "TRD2",
"TRE5", "TRE5", "TRE4", "TRE4", "TRE4", "TRE4", "TRF3", "TRF4",
"TRF3", "TRF3", "TRF3", "TRF3", "TRF3", "TRF4", "TRF3", "TRF4",
"TRF3", "TRF4", "TRF3", "TRF4", "TRF3", "TRF4", "TRF3", "TRF4",
"TRF3", "TRF4", "TRF4", "TRF4", "TRF3", "TRF4", "TRF3", "TRF4",
"TRF4", "TRF3", "TRF4", "TRF4", "TRF4", "TRD1", "TRD1", "TRD1",
"TRD1", "TRD1", "TRD1", "TRD1", "TRD1", "TRE2", "TRE2", "TRE1"
), Latitude = c(72.35019, 72.35019, 72.35019, 72.35019, 72.35019,
72.35019, 72.35019, 72.35019, 72.35019, 72.35019, 72.35019,
72.35019, 72.35019, 72.35019, 72.35019, 72.35019, 72.35019,
72.35019, 72.34705, 72.35019, 72.34705, 72.34705, 72.34705,
72.34705, 72.34705, 72.34705, 72.35019, 72.34705, 72.34705,
72.35019, 72.34705, 72.35019, 72.34705, 72.34705, 72.35019,
72.34705, 72.34705, 72.35019, 72.34705, 72.34705, 72.35019,
72.34705, 72.35019, 72.34705, 72.34705, 72.35019, 72.34705,
72.35019, 72.34705, 72.34705, 72.35019, 72.34705, 72.32009,
72.32009, 72.32195, 72.32195, 72.32195, 72.32195, 72.29368,
72.29111, 72.29368, 72.29368, 72.29368, 72.29368, 72.29368,
72.29111, 72.29368, 72.29111, 72.29368, 72.29111, 72.29368,
72.29111, 72.29368, 72.29111, 72.29368, 72.29111, 72.29368,
72.29111, 72.29111, 72.29111, 72.29368, 72.29111, 72.29368,
72.29111, 72.29111, 72.29368, 72.29111, 72.29111, 72.29111,
72.35019, 72.35019, 72.35019, 72.35019, 72.35019, 72.35019,
72.35019, 72.35019, 72.32544, 72.32544, 72.32738), Longitude = c(-81.09397,
-81.09397, -81.09397, -81.09397, -81.09397, -81.09397, -81.09397,
-81.09397, -81.09397, -81.09397, -81.09397, -81.09397, -81.09397,
-81.09397, -81.09397, -81.09397, -81.09397, -81.09397, -81.08279,
-81.09397, -81.08279, -81.08279, -81.08279, -81.08279, -81.08279,
-81.08279, -81.09397, -81.08279, -81.08279, -81.09397, -81.08279,
-81.09397, -81.08279, -81.08279, -81.09397, -81.08279, -81.08279,
-81.09397, -81.08279, -81.08279, -81.09397, -81.08279, -81.09397,
-81.08279, -81.08279, -81.09397, -81.08279, -81.09397, -81.08279,
-81.08279, -81.09397, -81.08279, -81.11921, -81.11921, -81.13219,
-81.13219, -81.13219, -81.13219, -81.16389, -81.16127, -81.16389,
-81.16389, -81.16389, -81.16389, -81.16389, -81.16127, -81.16389,
-81.16127, -81.16389, -81.16127, -81.16389, -81.16127, -81.16389,
-81.16127, -81.16389, -81.16127, -81.16389, -81.16127, -81.16127,
-81.16127, -81.16389, -81.16127, -81.16389, -81.16127, -81.16127,
-81.16389, -81.16127, -81.16127, -81.16127, -81.09397, -81.09397,
-81.09397, -81.09397, -81.09397, -81.09397, -81.09397, -81.09397,
-81.15897, -81.15897, -81.17314)), row.names = c(41276L,
41277L, 41278L, 41279L, 41280L, 41281L, 41282L, 41283L, 41284L,
41285L, 41286L, 41287L, 41288L, 41289L, 41290L, 41291L, 41292L,
41293L, 41294L, 41295L, 41296L, 41297L, 41298L, 41299L, 41300L,
41301L, 41302L, 41303L, 41304L, 41305L, 41306L, 41307L, 41309L,
41310L, 41311L, 41312L, 41313L, 41314L, 41315L, 41316L, 41317L,
41318L, 41319L, 41320L, 41323L, 41324L, 41326L, 41328L, 41329L,
41330L, 41331L, 41332L, 41432L, 41433L, 41434L, 41436L, 41437L,
41438L, 41441L, 41447L, 41448L, 41452L, 41454L, 41458L, 41460L,
41463L, 41464L, 41465L, 41466L, 41467L, 41469L, 41471L, 41472L,
41474L, 41475L, 41476L, 41477L, 41478L, 41479L, 41480L, 41481L,
41482L, 41483L, 41484L, 41485L, 41486L, 41487L, 41488L, 41489L,
36498L, 36504L, 36510L, 36515L, 36521L, 36524L, 36528L, 36530L,
36765L, 36769L, 36775L), class = "data.frame")