title: How can I remove all elements from a vector that matches a pattern?
body: <pre><code>ncvars = c(&quot;prate&quot;, &quot;arate&quot;, &quot;wpd&quot;, &quot;Atm1&quot;, &quot;Atm2&quot;, &quot;area&quot;, &quot;fC&quot;, &quot;bas__1&quot;, &quot;bas__asssaa&quot;, &quot;bas__Clow&quot;, &quot;bas__g2333e&quot;, &quot;baser__arge&quot;, &quot;bas__Aow&quot;, &quot;bas__Aass&quot;)   
  </code></pre>
  <p>Now, I want to remove all elements that are</p>
  <ul>
  <li>exactly the name <code>area</code></li>
  <li>matches this string <code>bas__</code></li>
  </ul>
  <p>How can I do this?</p>
  <hr />
  <p>Trial</p>
  <pre><code>patterns &lt;- c(&quot;bas__&quot;, &quot;area&quot;)
  ncvars %&gt;%
    filter(.,grepl(paste(patterns, collapse=&quot;|&quot;)))
  </code></pre>