title: How to ignore NA in R?
body: <p>I am doing some analysis and whenever <code>NA</code> is found, my loop stops which takes one by one. So I want to say if my value is not <code>NA</code> go ahead and further in the loop. if it is <code>NA</code> just ignore it and go for the next one. or even return <code>NA</code>.
  I tried this:</p>
  
  <pre><code>  x=c(5,4,6,4,2,1,5,NA)
    if (x != NA){
    y=x+2}
  
  
   Error in if (x != NA) { : missing value where TRUE/FALSE needed
  </code></pre>