任何人都可以帮我解决错误。我想检查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
答案 0 :(得分: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
};