计算R中的轴承

时间:2015-06-04 02:30:40

标签: r

我正在尝试使用bearingTrack包中的argosfilter函数计算R中连续纬度/经度位置之间的角度。我已经使用了这个包中的distanceTrack函数和我需要的滤波器,所以我只用轴承代替了距离。这是我用过的代码:

这是在应用以下所有代码后给我错误的输入:

dput:

    lizard<-structure(list(Longitude = c(139.348233, 139.348208, 139.348093, 
    139.348085, 139.347863, 139.347893, 139.347903, 139.347918, 139.34784, 
    139.34773, 139.34753, 139.347453, 139.347288, 139.347308, 139.347307, 
    139.34733, 139.347332, 139.34733, 139.347312, 139.347317, 139.34731, 
    139.347293, 139.347312, 139.347297, 139.347332, 139.34731, 139.347308, 
    139.347337, 139.347308, 139.34731, 139.34731, 139.347307, 139.347312, 
    139.347325, 139.347332, 139.347327, 139.347325, 139.347338, 139.347348, 
    139.347315, 139.347305, 139.347337, 139.347355, 139.347338, 139.347322, 
    139.347327, 139.347363, 139.347343, 139.347722, 139.34774, 139.347723, 
    139.34773, 139.34787, 139.347957, 139.34795, 139.347825, 139.3478, 
    139.347773, 139.34791, 139.347847, 139.347817, 139.347822, 139.347775, 
    139.347785, 139.347778, 139.347827, 139.34779, 139.347742, 139.347848, 
    139.347845, 139.347847, 139.34786, 139.347853, 139.347848, 139.347823, 
    139.347843, 139.347838, 139.347825, 139.347842, 139.347848, 139.347837, 
    139.34783, 139.347847, 139.347805, 139.347838, 139.34782, 139.347855, 
    139.347858, 139.347832, 139.347822, 139.347857, 139.347852, 139.347845, 
    139.347847, 139.347848, 139.347843, 139.34788, 139.347795, 139.347848, 
    139.347808, 139.347825, 139.347852, 139.347863, 139.347858, 139.347837, 
    139.347847, 139.347853, 139.347813, 139.347843, 139.347863, 139.347812, 
    139.347853, 139.347862, 139.34789, 139.347897, 139.347848, 139.347858, 
    139.347845, 139.34786, 139.34786, 139.347847, 139.347833, 139.347868, 
    139.347865, 139.347837, 139.347873, 139.34785, 139.347867, 139.34787, 
    139.347913, 139.347897, 139.347855, 139.347858, 139.347843, 139.347852, 
    139.347857, 139.34783, 139.347837, 139.347812, 139.347775, 139.34784, 
    139.347837, 139.34785, 139.347722, 139.34776, 139.347692, 139.347735, 
    139.347697, 139.347708, 139.34773, 139.347745, 139.347685, 139.347755, 
    139.34767, 139.347747, 139.347748, 139.347725, 139.34774, 139.347728, 
    139.347722, 139.34772, 139.347708, 139.347722, 139.347728, 139.347715, 
    139.34771, 139.347688, 139.347707, 139.347727, 139.347743, 139.347737, 
    139.347743, 139.347732, 139.347732, 139.347767, 139.34773, 139.347748, 
    139.347733, 139.347718, 139.347707, 139.3477, 139.34771, 139.3477, 
    139.347697, 139.34857, 139.348607, 139.348642, 139.348595, 139.34861, 
    139.34859, 139.348607, 139.348633, 139.348607, 139.348623, 139.348603, 
    139.348658, 139.348622, 139.348612, 139.348582, 139.348578), 
    Latitude = c(-33.90222, -33.902223, -33.902388, -33.902442, 
-33.902713, -33.903037, -33.903303, -33.903327, -33.903217, 
-33.902997, -33.902807, -33.902367, -33.902305, -33.90231, 
-33.902318, -33.902298, -33.90231, -33.902328, -33.902312, 
-33.902295, -33.902302, -33.902297, -33.902303, -33.902285, 
-33.902305, -33.902277, -33.902303, -33.902315, -33.902305, 
-33.902302, -33.902307, -33.902313, -33.902318, -33.902313, 
-33.902313, -33.902305, -33.902318, -33.9023, -33.902278, 
-33.902298, -33.902327, -33.902307, -33.902277, -33.902283, 
-33.902285, -33.902243, -33.902247, -33.902315, -33.903317, 
-33.903307, -33.903305, -33.903318, -33.903353, -33.903323, 
-33.903185, -33.903087, -33.903093, -33.903078, -33.903047, 
-33.903042, -33.903045, -33.903038, -33.903053, -33.903043, 
-33.903047, -33.903013, -33.903037, -33.903028, -33.903028, 
-33.903142, -33.903145, -33.903127, -33.90315, -33.903137, 
-33.90317, -33.903128, -33.903148, -33.903147, -33.903133, 
-33.903157, -33.903142, -33.903122, -33.903125, -33.903108, 
-33.903117, -33.903102, -33.903127, -33.903135, -33.903147, 
-33.903148, -33.90316, -33.903135, -33.903117, -33.903135, 
-33.903133, -33.90313, -33.90313, -33.903137, -33.90314, 
-33.903157, -33.90311, -33.90314, -33.903135, -33.903137, 
-33.903135, -33.903152, -33.903123, -33.903163, -33.903148, 
-33.903147, -33.903113, -33.903167, -33.90317, -33.903302, 
-33.90333, -33.903188, -33.903152, -33.903155, -33.903147, 
-33.903142, -33.903147, -33.903132, -33.903163, -33.903165, 
-33.90316, -33.90314, -33.903167, -33.903158, -33.90316, 
-33.903138, -33.903158, -33.903128, -33.903135, -33.903125, 
-33.903133, -33.90314, -33.903127, -33.903138, -33.903112, 
-33.903125, -33.903127, -33.903148, -33.90313, -33.902708, 
-33.902713, -33.902712, -33.9027, -33.902687, -33.902698, 
-33.902722, -33.902688, -33.90265, -33.902718, -33.902727, 
-33.902717, -33.902717, -33.902707, -33.9027, -33.902718, 
-33.902762, -33.902702, -33.902713, -33.902685, -33.902697, 
-33.902717, -33.902693, -33.902742, -33.902683, -33.902682, 
-33.902743, -33.902688, -33.902705, -33.902693, -33.902695, 
-33.902672, -33.902687, -33.902668, -33.90269, -33.90272, 
-33.902725, -33.902712, -33.902708, -33.90269, -33.902678, 
-33.902892, -33.90271, -33.902653, -33.902722, -33.902678, 
-33.902738, -33.902722, -33.902708, -33.902742, -33.902703, 
-33.902722, -33.902715, -33.902782, -33.902632, -33.902697, 
-33.902727), Altitude = c(134L, 136L, 132L, 136L, 134L, 132L, 
134L, 134L, 134L, 134L, 132L, 130L, 136L, 132L, 136L, 134L, 
136L, 132L, 132L, 136L, 136L, 134L, 140L, 136L, 142L, 130L, 
136L, 136L, 136L, 132L, 136L, 138L, 134L, 138L, 140L, 142L, 
140L, 138L, 140L, 140L, 140L, 138L, 144L, 140L, 138L, 134L, 
136L, 138L, 134L, 136L, 134L, 136L, 134L, 138L, 134L, 136L, 
136L, 138L, 140L, 136L, 134L, 134L, 130L, 128L, 128L, 134L, 
130L, 126L, 132L, 132L, 132L, 132L, 132L, 132L, 142L, 136L, 
136L, 136L, 136L, 134L, 134L, 136L, 132L, 134L, 134L, 132L, 
142L, 138L, 144L, 142L, 140L, 138L, 138L, 140L, 142L, 140L, 
142L, 134L, 138L, 136L, 138L, 134L, 140L, 130L, 128L, 136L, 
128L, 130L, 134L, 132L, 126L, 136L, 132L, 136L, 134L, 132L, 
132L, 134L, 132L, 132L, 132L, 132L, 134L, 134L, 136L, 134L, 
134L, 136L, 142L, 140L, 138L, 130L, 130L, 128L, 128L, 130L, 
132L, 128L, 130L, 130L, 132L, 138L, 132L, 134L, 134L, 134L, 
140L, 136L, 136L, 142L, 140L, 128L, 144L, 132L, 136L, 132L, 
138L, 140L, 138L, 138L, 138L, 138L, 138L, 142L, 138L, 134L, 
136L, 132L, 136L, 140L, 136L, 136L, 134L, 134L, 132L, 130L, 
128L, 128L, 132L, 126L, 130L, 130L, 128L, 124L, 132L, 130L, 
132L, 132L, 128L, 134L, 132L, 136L, 142L, 118L, 124L, 118L, 
110L, 114L, 128L, 132L), Satellites = c(8L, 8L, 8L, 8L, 8L, 
8L, 8L, 8L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 
7L, 7L, 7L, 6L, 6L, 6L, 7L, 7L, 7L, 6L, 6L, 6L, 6L, 6L, 6L, 
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 8L, 8L, 
8L, 8L, 7L, 7L, 7L, 7L, 6L, 6L, 6L, 8L, 8L, 7L, 6L, 6L, 6L, 
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 6L, 6L, 6L, 6L, 7L, 7L, 
7L, 7L, 7L, 6L, 6L, 6L, 7L, 7L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 
6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 6L, 
7L, 6L, 6L, 6L, 6L, 6L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 7L, 
7L, 7L, 6L, 6L, 6L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 
7L, 6L, 6L, 7L, 7L, 7L, 7L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 8L, 8L, 
8L, 8L, 8L, 7L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 8L, 
8L, 7L, 7L, 8L, 7L, 7L, 8L, 7L, 6L, 6L, 6L, 6L, 6L, 6L, 6L
), HDOP = c(1, 1, 0.8, 0.8, 0.8, 0.8, 1, 0.8, 1.6, 1.6, 1.6, 
1.6, 1.2, 1.2, 1.2, 1.2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.2, 
1, 1, 1, 1, 1, 1, 1, 1.8, 1.8, 1.4, 1.4, 1.4, 1.4, 1.2, 1.2, 
1.2, 1.2, 1.4, 1.4, 1.4, 1.4, 1.4, 1.2, 1.2, 1.2, 1.2, 1.2, 
1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 1.2, 2.2, 2.6, 2.6, 2.4, 
2.4, 2.2, 2.2, 2, 1.6, 1.4, 1.4, 1.4, 1, 1, 1.2, 1.2, 1.2, 
1, 1, 1, 1, 1, 1.2, 1.2, 1.2, 1.2, 1.2, 1.4, 1.4, 1.4, 1.4, 
1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.6, 1.8, 2, 1.4, 1.4, 1.4, 
1.2, 1.2, 1.2, 1.2, 1.2, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 1.4, 
0.8, 0.8, 0.8, 0.8, 0.8, 1, 0.8, 0.8, 1, 1, 1, 1.4, 1.4, 
1.4, 0.8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.2, 1.2, 1.2, 1.2, 
1.4, 1.6, 1.8, 2, 2.4, 2.6, 2.4, 2, 2, 1, 1, 1.4, 1.4, 1.4, 
1.4, 1.4, 1.4, 1.4, 1.4, 1.6, 1.6, 1.8, 2, 1.2, 1.4, 1.4, 
1.4, 1.4, 2, 1.8, 1.6, 1.4, 1.4, 1.4, 1.4, 1.2, 1.2, 1.4, 
1.4, 1.2, 1, 1.6, 1.8, 1, 1.8, 1.8, 1, 1.6, 1.8, 1.8, 1.8, 
1.8, 1.6, 1.4, 1.2), DateTime = structure(1:200, .Label = c("2014/11/08 07:10:00", 
"2014/11/08 07:20:00", "2014/11/08 07:30:00", "2014/11/08 07:40:00", 
"2014/11/08 07:50:00", "2014/11/08 08:00:00", "2014/11/08 08:10:00", 
"2014/11/08 08:20:00", "2014/11/08 08:30:00", "2014/11/08 08:40:00", 
"2014/11/08 08:50:00", "2014/11/08 09:00:00", "2014/11/08 17:30:00", 
"2014/11/08 18:40:00", "2014/11/08 18:50:00", "2014/11/08 19:00:00", 
"2014/11/08 19:10:00", "2014/11/08 19:20:00", "2014/11/08 19:30:00", 
"2014/11/08 19:40:00", "2014/11/08 19:50:00", "2014/11/08 20:00:00", 
"2014/11/08 20:10:00", "2014/11/08 20:20:00", "2014/11/08 20:30:00", 
"2014/11/08 20:40:00", "2014/11/08 21:30:00", "2014/11/08 21:40:00", 
"2014/11/08 21:50:00", "2014/11/08 22:00:00", "2014/11/08 22:10:00", 
"2014/11/08 22:20:00", "2014/11/08 22:30:00", "2014/11/08 23:30:00", 
"2014/11/08 23:40:00", "2014/11/09 02:40:00", "2014/11/09 02:50:00", 
"2014/11/09 03:00:00", "2014/11/09 03:10:00", "2014/11/09 03:20:00", 
"2014/11/09 03:30:00", "2014/11/09 03:40:00", "2014/11/09 03:50:00", 
"2014/11/09 05:30:00", "2014/11/09 05:40:00", "2014/11/09 05:50:00", 
"2014/11/09 06:00:00", "2014/11/09 06:10:00", "2014/11/09 08:30:00", 
"2014/11/09 08:40:00", "2014/11/09 08:50:00", "2014/11/09 09:00:00", 
"2014/11/09 09:10:00", "2014/11/09 09:20:00", "2014/11/09 09:30:00", 
"2014/11/09 09:40:00", "2014/11/09 10:30:00", "2014/11/09 10:40:00", 
"2014/11/09 10:50:00", "2014/11/09 13:30:00", "2014/11/09 13:40:00", 
"2014/11/09 13:50:00", "2014/11/09 14:00:00", "2014/11/09 14:10:00", 
"2014/11/09 14:20:00", "2014/11/09 14:30:00", "2014/11/09 14:40:00", 
"2014/11/09 14:50:00", "2014/11/09 15:00:00", "2014/11/09 15:40:00", 
"2014/11/09 15:50:00", "2014/11/09 16:00:00", "2014/11/09 16:10:00", 
"2014/11/09 17:20:00", "2014/11/09 17:30:00", "2014/11/09 17:40:00", 
"2014/11/09 17:50:00", "2014/11/09 18:00:00", "2014/11/09 19:30:00", 
"2014/11/09 19:40:00", "2014/11/09 19:50:00", "2014/11/09 20:00:00", 
"2014/11/09 20:10:00", "2014/11/09 20:20:00", "2014/11/09 20:30:00", 
"2014/11/09 20:40:00", "2014/11/09 23:30:00", "2014/11/09 23:40:00", 
"2014/11/09 23:50:00", "2014/11/10 00:00:00", "2014/11/10 00:10:00", 
"2014/11/10 00:20:00", "2014/11/10 00:30:00", "2014/11/10 00:40:00", 
"2014/11/10 02:40:00", "2014/11/10 02:50:00", "2014/11/10 03:00:00", 
"2014/11/10 03:10:00", "2014/11/10 03:20:00", "2014/11/10 03:30:00", 
"2014/11/10 03:40:00", "2014/11/10 06:30:00", "2014/11/10 06:40:00", 
"2014/11/10 06:50:00", "2014/11/10 07:00:00", "2014/11/10 07:10:00", 
"2014/11/10 07:20:00", "2014/11/10 07:30:00", "2014/11/10 07:40:00", 
"2014/11/10 07:50:00", "2014/11/10 08:00:00", "2014/11/10 08:10:00", 
"2014/11/10 08:20:00", "2014/11/10 09:00:00", "2014/11/10 09:10:00", 
"2014/11/10 09:20:00", "2014/11/10 11:10:00", "2014/11/10 11:20:00", 
"2014/11/10 11:30:00", "2014/11/10 11:40:00", "2014/11/10 11:50:00", 
"2014/11/10 12:00:00", "2014/11/10 12:10:00", "2014/11/10 12:20:00", 
"2014/11/10 12:30:00", "2014/11/10 12:40:00", "2014/11/10 12:50:00", 
"2014/11/10 13:00:00", "2014/11/10 13:10:00", "2014/11/10 13:20:00", 
"2014/11/10 13:30:00", "2014/11/10 13:40:00", "2014/11/10 13:50:00", 
"2014/11/10 14:00:00", "2014/11/10 14:10:00", "2014/11/10 14:20:00", 
"2014/11/10 14:30:00", "2014/11/10 14:40:00", "2014/11/10 14:50:00", 
"2014/11/10 15:00:00", "2014/11/10 15:10:00", "2014/11/10 15:20:00", 
"2014/11/10 15:30:00", "2014/11/10 19:30:00", "2014/11/10 19:40:00", 
"2014/11/10 19:50:00", "2014/11/10 20:00:00", "2014/11/10 20:10:00", 
"2014/11/10 20:20:00", "2014/11/10 20:30:00", "2014/11/10 20:40:00", 
"2014/11/10 20:50:00", "2014/11/10 21:00:00", "2014/11/10 21:10:00", 
"2014/11/10 22:10:00", "2014/11/10 22:20:00", "2014/11/11 00:50:00", 
"2014/11/11 01:00:00", "2014/11/11 01:10:00", "2014/11/11 01:20:00", 
"2014/11/11 02:30:00", "2014/11/11 02:40:00", "2014/11/11 02:50:00", 
"2014/11/11 03:00:00", "2014/11/11 03:10:00", "2014/11/11 03:20:00", 
"2014/11/11 03:30:00", "2014/11/11 03:40:00", "2014/11/11 05:30:00", 
"2014/11/11 05:40:00", "2014/11/11 05:50:00", "2014/11/11 06:00:00", 
"2014/11/11 06:10:00", "2014/11/11 06:20:00", "2014/11/11 06:30:00", 
"2014/11/11 06:40:00", "2014/11/11 06:50:00", "2014/11/11 07:00:00", 
"2014/11/11 07:10:00", "2014/11/11 07:20:00", "2014/11/11 07:30:00", 
"2014/11/11 07:40:00", "2014/11/11 07:50:00", "2014/11/11 08:00:00", 
"2014/11/11 09:30:00", "2014/11/11 09:40:00", "2014/11/11 10:00:00", 
"2014/11/11 10:10:00", "2014/11/11 10:20:00", "2014/11/11 10:30:00", 
"2014/11/11 10:40:00", "2014/11/11 10:50:00", "2014/11/11 11:00:00", 
"2014/11/11 11:20:00", "2014/11/11 11:30:00", "2014/11/11 11:40:00", 
"2014/11/11 12:00:00", "2014/11/11 14:50:00", "2014/11/11 19:10:00", 
"2014/11/11 19:20:00", "2014/11/11 19:30:00", "2014/11/11 20:00:00", 
"2014/11/11 23:20:00", "2014/11/12 02:30:00", "2014/11/12 02:40:00", 
"2014/11/12 04:20:00", "2014/11/12 04:30:00", "2014/11/12 04:40:00", 
"2014/11/12 04:50:00", "2014/11/12 05:00:00", "2014/11/12 05:10:00", 
"2014/11/12 05:20:00", "2014/11/12 08:10:00", "2014/11/12 10:50:00", 
"2014/11/12 11:00:00", "2014/11/12 11:10:00", "2014/11/12 11:20:00", 
"2014/11/12 13:40:00", "2014/11/12 13:50:00", "2014/11/12 14:00:00", 
"2014/11/12 14:10:00", "2014/11/12 20:30:00", "2014/11/12 20:40:00", 
"2014/11/12 20:50:00", "2014/11/12 21:00:00", "2014/11/12 21:10:00", 
"2014/11/12 22:00:00", "2014/11/12 22:10:00", "2014/11/12 23:00:00", 
"2014/11/12 23:10:00", "2014/11/12 23:20:00", "2014/11/12 23:30:00", 
"2014/11/12 23:40:00", "2014/11/12 23:50:00", "2014/11/13 00:00:00", 
"2014/11/13 00:10:00", "2014/11/13 00:20:00", "2014/11/13 00:30:00", 
"2014/11/13 01:30:00", "2014/11/13 01:40:00", "2014/11/13 01:50:00", 
"2014/11/13 02:00:00", "2014/11/13 02:10:00", "2014/11/13 02:30:00", 
"2014/11/13 02:40:00", "2014/11/13 02:50:00", "2014/11/13 03:00:00", 
"2014/11/13 03:10:00", "2014/11/13 03:20:00", "2014/11/13 03:30:00", 
"2014/11/13 05:30:00", "2014/11/13 05:40:00", "2014/11/13 05:50:00", 
"2014/11/13 06:00:00", "2014/11/13 06:10:00", "2014/11/13 06:20:00", 
"2014/11/13 06:30:00", "2014/11/13 06:40:00", "2014/11/13 06:50:00", 
"2014/11/13 07:00:00", "2014/11/13 07:10:00", "2014/11/13 07:40:00", 
"2014/11/13 07:50:00", "2014/11/13 08:20:00", "2014/11/13 09:20:00", 
"2014/11/14 08:50:00", "2014/11/14 09:00:00", "2014/11/14 09:10:00", 
"2014/11/14 09:20:00", "2014/11/14 10:30:00", "2014/11/14 12:10:00", 
"2014/11/14 12:20:00", "2014/11/14 12:30:00", "2014/11/14 12:40:00", 
"2014/11/14 12:50:00", "2014/11/14 13:00:00", "2014/11/14 13:10:00", 
"2014/11/14 13:20:00", "2014/11/14 13:30:00", "2014/11/14 13:40:00", 
"2014/11/14 13:50:00", "2014/11/14 14:00:00", "2014/11/14 14:10:00", 
"2014/11/14 14:20:00", "2014/11/14 23:00:00", "2014/11/14 23:10:00", 
"2014/11/15 01:30:00", "2014/11/15 01:40:00", "2014/11/15 01:50:00", 
"2014/11/15 02:00:00", "2014/11/15 02:10:00", "2014/11/15 02:20:00", 
"2014/11/15 02:30:00", "2014/11/15 02:40:00", "2014/11/15 02:50:00", 
"2014/11/15 03:10:00", "2014/11/15 03:20:00", "2014/11/15 05:30:00", 
"2014/11/15 05:40:00", "2014/11/15 05:50:00", "2014/11/15 06:00:00", 
"2014/11/15 06:10:00", "2014/11/15 06:20:00", "2014/11/15 06:30:00", 
"2014/11/15 06:40:00", "2014/11/15 06:50:00", "2014/11/15 07:00:00", 
"2014/11/15 07:10:00", "2014/11/15 07:20:00", "2014/11/15 07:30:00", 
"2014/11/15 07:40:00", "2014/11/15 07:50:00", "2014/11/15 09:20:00", 
"2014/11/15 09:30:00", "2014/11/15 09:40:00", "2014/11/15 09:50:00", 
"2014/11/15 10:00:00", "2014/11/15 10:10:00", "2014/11/15 11:30:00", 
"2014/11/15 11:40:00", "2014/11/15 11:50:00", "2014/11/15 12:00:00", 
"2014/11/15 12:10:00", "2014/11/15 12:20:00", "2014/11/15 12:30:00", 
"2014/11/15 12:40:00", "2014/11/15 12:50:00", "2014/11/15 13:00:00", 
"2014/11/15 13:10:00", "2014/11/15 15:30:00", "2014/11/15 15:40:00", 
"2014/11/15 15:50:00", "2014/11/15 16:00:00", "2014/11/15 16:10:00", 
"2014/11/15 16:20:00", "2014/11/15 16:30:00", "2014/11/15 16:40:00", 
"2014/11/15 16:50:00", "2014/11/15 17:50:00", "2014/11/15 21:30:00", 
"2014/11/15 21:40:00", "2014/11/15 21:50:00", "2014/11/15 22:00:00", 
"2014/11/15 23:00:00", "2014/11/15 23:10:00"), class = "factor"), 
speedFilter = 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, 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 = "not", class =            "factor")), .Names = c("Longitude", 
     "Latitude", "Altitude", "Satellites", "HDOP", "DateTime", "speedFilter"
     ), row.names = c(NA, 200L), class = "data.frame")

代码:

#install.packages("argosfilter")
library(argosfilter)

lizard$DateTime <- as.POSIXct(lizard$DateTime)
lizard$Angle <- NA 
lizard$Angle[2:nrow(lizard)] <- bearingTrack(lizard$Lat, lizard$Lon)
lizard$isContiguous <- TRUE 
lizard$isContiguous[2:nrow(lizard)] <-       (as.numeric(lizard$DateTime[2:nrow(lizard)] - lizard$DateTime[1:nrow(lizard) - 1]) == 10)
lizard <- lizard[lizard$isContiguous, ] 

对于我的大部分数据而言,这没有任何问题,但对于某些数据,我收到以下错误:

  

if(方位> 180)轴承=轴承时出错 - 360:缺少值需要TRUE / FALSE

我对R不是很好,所以修复它可能是一个简单的问题,但任何有关如何修复它的建议都会很棒。

1 个答案:

答案 0 :(得分:1)

您似乎遇到了LongitudeLatitude的重复值问题。这似乎现在正在起作用。这些是你想要的结果吗?

lizard$DateTime <- as.POSIXct(lizard$DateTime)

#Remove duplicates from Longitude and Latitude columns 
lizard <- lizard[!duplicated(lizard[c("Longitude", "Latitude")]),]

lizard$Angle[2:nrow(lizard)] <- bearingTrack(lizard$Latitude, lizard$Longitude)
lizard$isContiguous <- TRUE 
lizard$isContiguous[2:nrow(lizard)] <-       (as.numeric(lizard$DateTime[2:nrow(lizard)] - lizard$DateTime[1:nrow(lizard) - 1]) == 10)
lizard <- lizard[lizard$isContiguous, ] 

结果

   Longitude  Latitude Altitude Satellites HDOP            DateTime speedFilter      Angle isContiguous
1   139.3482 -33.90222      134          8  1.0 2014-11-08 07:10:00         not         NA         TRUE
2   139.3482 -33.90222      136          8  1.0 2014-11-08 07:20:00         not  -98.23378         TRUE
3   139.3481 -33.90239      132          8  0.8 2014-11-08 07:30:00         not -149.95233         TRUE
4   139.3481 -33.90244      136          8  0.8 2014-11-08 07:40:00         not -172.92556         TRUE
5   139.3479 -33.90271      134          8  0.8 2014-11-08 07:50:00         not -145.78766         TRUE
6   139.3479 -33.90304      132          8  0.8 2014-11-08 08:00:00         not  175.60411         TRUE
7   139.3479 -33.90330      134          8  1.0 2014-11-08 08:10:00         not  178.22120         TRUE
8   139.3479 -33.90333      134          8  0.8 2014-11-08 08:20:00         not  152.57339         TRUE
9   139.3478 -33.90322      134          6  1.6 2014-11-08 08:30:00         not  -30.47532         TRUE
10  139.3477 -33.90300      134          6  1.6 2014-11-08 08:40:00         not  -22.53824         TRUE