Error in if/while (condition) {: missing Value where TRUE/FALSE needed

后端 未结 3 605
[愿得一人]
[愿得一人] 2020-11-21 23:19

I received this error message:

Error in if (condition) { : missing value where TRUE/FALSE needed

or

Error in while (conditi         


        
3条回答
  •  灰色年华
    2020-11-21 23:55

    this works with "NA" not for NA

    comments = c("no","yes","NA")
      for (l in 1:length(comments)) {
        #if (!is.na(comments[l])) print(comments[l])
        if (comments[l] != "NA") print(comments[l])
      }
    

提交回复
热议问题