title: R - Remove all rows that do not match certain criteria
body: <p>Below is what my data looks like. My goal is to find all rows that have matching x, z, and m, but different y. And I need to keep both, or all, of the ones that have the differing y.</p>
  <p>How can I do that?</p>
  <pre><code>x &lt;- c(&quot;A&quot;,&quot;B&quot;,&quot;C&quot;,&quot;B&quot;,&quot;D&quot;,&quot;E&quot;,&quot;E&quot;)
  y &lt;- c(0,10,10,10,10,12,0)
  z &lt;- c(&quot;A1&quot;,&quot;B1&quot;,&quot;B1&quot;,&quot;B1&quot;,&quot;B1&quot;,&quot;C1&quot;,&quot;C1&quot;)
  m &lt;- c(rep(&quot;2017-12-28&quot;,7))
  
  df &lt;- data.frame(x,y,z,m)
  df
  
  # Below is the goal
  df[6:7,]
  </code></pre>