0
我试图根据距离和方位从数据框中的第一点对位置点进行分类。此代码正在工作,但它只检查df$dist
列的距离。R - 将数据帧剪成两列
df$circle_id = cut(df$dist, seq(0,41000000,1000), labels=FALSE, include.lowest=TRUE)
我想要做的还是检查点的方位是否相同,只有它们可以放在同一个类别中。轴承储存在df$bearing
。
简单地说,我需要这两项业务合并为一个:
df$circle_id = cut(df$dist, seq(0,41000000,1000), include.lowest=TRUE)
df$circle_id = cut(df$bearing, seq(-180,180,10), labels=FALSE, include.lowest=TRUE)
的样本数据帧:
latitude longitude sensor_time circle_id segment_id weight dist bearing
1 48.15144 17.07569 1447149703 1 1 2 0.000000 -180.00000
3 48.15404 17.07452 1447149743 3 1 1 302.422843 163.22826
4 48.15277 17.07514 1447149762 2 1 1 153.179367 164.50437
5 48.15208 17.07538 1447149771 1 1 1 74.666669 161.91792
6 48.15461 17.07560 1447149773 3 1 3 353.106770 178.87100
9 48.15139 17.07562 1447149811 1 1 2 7.828957 43.83916
任何帮助表示赞赏, 谢谢
设置'labels'参数。 – alistaire