更新时间:2022-12-09 13:40:20
鉴于您要存储在新列中的输出是这样的:
Given that the output you want to store in the new column is this:
77.54033 135.23165
尝试一下
df$distance<-distHaversine(df[,1:2], df[,3:4])
哪个应该回来
> df
lat1 lon1 lat2 lon2 distance
1 7.348687 53.36575 7.348940 53.36507 77.54033
2 7.348940 53.36507 7.350939 53.36484 135.23165