title: I am trying to use an if else loop to check multiple columns for data ranges, how do I make it so that it ignores NAs in my data
body: <p>I am trying to check numbers in three columns in a data frame and if they're within a certain range, I want a certain output.  I have this part of the code, but one of my tests wants to know if all three are negative, then I get a certain output. My issue is that some of the data in some of the columns are NA.  I want to ignore the NAs in my logic.  Is there a way to do this? A sample of my code is below.</p>
  
  <pre><code>if((DataWSGR$RouteType == 7 | DataWSGR$RouteType == 9) &amp; (DataWSGR$SGR &gt; 5 ) &amp; (0 &lt; DataWSGR$`30_Year_SGR` &lt; 5) &amp; (0 &lt; DataWSGR$`20_Year_SGR` &lt; 5) &amp; (0 &lt; DataWSGR$`10_Year_SGR` &lt; 5)) {}
  </code></pre>
  
  <p>The 10, 20, and 30 year SGRs are the columns that will have NAs in them. </p>