title: How to filter data without losing NA rows using dplyr
body: <p><a href="https://stackoverflow.com/questions/40446165/how-to-subset-data-in-r-without-losing-na-rows">How to subset data in R without losing NA rows?</a></p>
  
  <p>The post above subsets using logical indexing. <strong>Is there a way to do it in dplyr?</strong> </p>
  
  <p>Also, <strong>when does dplyr automatically delete NAs?</strong> In my experience, it removes NA when I filter out a specific string, eg:</p>
  
  <pre><code>b = a %&gt;% filter(col != "str")
  </code></pre>
  
  <p>I would think this would not exclude <code>NA</code> values but it does. But when I use other format of filtering, it does not automatically exclude <code>NA</code>, eg:</p>
  
  <pre><code>b = a %&gt;% filter(!grepl("str", col))
  </code></pre>
  
  <p>I would like to understand this feature of filter. I would appreciate any help. Thank you!</p>