簡體   English   中英

克服替換長度為零的錯誤

[英]Overcome the replacement has length zero Error

我在數據集上運行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. 什么是GNfindNearby
  2. 嘗試使用sp軟件包中的spDistsspDistsN1函數。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM