0

谁能帮我解决错误。我想检查 IF 语句,如果没有 Null 则插入该值。

 while (i < 33 )
{
 library(jsonlite)
 library(httr)
 get_reply2 <- my_get(staypoints$Stayplon[i],staypoints$staypLat[i], 2)
 get_replyFF2 <- append(get_replyFF2, get_reply2$value$id) 
 get_replyFG2 <- append(get_replyFG2, get_reply2$value$title) 
  if (get_replyFF2[i] != 0)
  {
  LONGG <- append(LONGG, staypoints$Stayplon[i])
  LATT <- append(LATT, staypoints$Stayplon[i])
  }

   i <- i + 1
 };

 Error: Error in if (get_replyFF2[i] != 0) { : 
 missing value where TRUE/FALSE needed
4

1 回答 1

0
while (i < 33 )
{
 library(jsonlite)
 library(httr)
 get_reply2 <- my_get(staypoints$Stayplon[i],staypoints$staypLat[i], 2)
 get_replyFF2 <- append(get_replyFF2, get_reply2$value$id) 
 get_replyFG2 <- append(get_replyFG2, get_reply2$value$title) 
 if (length(get_reply2) != 0)
  {
  LONGG <- append(LONGG, staypoints$Stayplon[i])
  LATT <- append(LATT, staypoints$staypLat[i])
   }  

    i <- i + 1
   };
于 2017-10-23T11:37:25.217 回答