克服更换的长度为零误差

时间:2018-02-12 16:24:00

标签: r

我在数据集上运行for循环以检索某个经度和纬度值附近的位置,并且只要有NA,for循环就会停止。是否有可能继续执行for循环并忽略丢失的信息。

for(i in 1:nrow(top)){

 x <- (top[i,c("V3")]) ////latitude value
 y <- (top[i,c("V4")]) /// longitude value

res <- GNfindNearby(lat=x, lng=y,radius=0.01) /// near by places
top[i,"Location"] <- res

}

1 个答案:

答案 0 :(得分:0)

  1. 什么是GNfindNearby
  2. 尝试使用 sp 包中的spDistsspDistsN1函数。
相关问题