r - If else statement comparing to 0 or NA -


I have an element in the data frame tmp which may contain any number, 0 or NA if that element is neither 0 nor Or NA, then I should have something Otherwise, nothing happens, I think it looks like this:

  if (tmp [2, 1 9]! = (0, NA)) {something}   

I get this error: if error (TMP [2, 1 9] == (0) AA): {: absent value where TRUE / FALSE is required, I do not know It is not possible to compare both an int and string in R, or if I am misusing the bus or operator. I have tried different forms in different cases but are not able to determine the problem Please help!

@ GSE said in a comment, you is.na : < / P>

  if (tmp [2, 1 9]! = 0 || is.na (tmp [2, 1 9])) {# do stuff}  < And ? NA .   

Comments