title: Filtering ids when they have the same value across a column in r
body: <p>I am trying to filter a dataset when all scores are the same value within each id. Here is my sample dataset looks like:</p>
  <pre><code>df &lt;- data.frame(id = c(1,1,1,1,1,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5),
                   score = c(0,1,2,0,1,1,1,1,1,0,1,2,3,3,3,3,3,3,3,0,0,0))
  
  &gt; df
     id score
  1   1     0
  2   1     1
  3   1     2
  4   1     0
  5   1     1
  6   2     1
  7   2     1
  8   2     1
  9   2     1
  10  3     0
  11  3     1
  12  3     2
  13  3     3
  14  3     3
  15  4     3
  16  4     3
  17  4     3
  18  4     3
  19  4     3
  20  5     0
  21  5     0
  22  5     0
  </code></pre>
  <p>In this dataset, I only need to keep <code>id</code> <code>c(2,4,5)</code> because this <code>id</code>s have the same values in the <code>score</code> column.</p>
  <p>I was only able to filter the <code>score=0</code> <code>id</code> by</p>
  <pre><code>df.1 &lt;- df %&gt;% 
    group_by(id) %&gt;%
    summarize(sum = sum(score)) %&gt;% filter(sum == 0)
  </code></pre>
  <p>My desired output would look like:</p>
  <pre><code>&gt; df
     id score
  1   2     1
  2   2     1
  3   2     1
  4   2     1
  5   4     3
  6   4     3
  7   4     3
  8   4     3
  9   4     3
  10  5     0
  11  5     0
  12  5     0
  </code></pre>
  <p>NOTE: the max score is 3 here but I need a global solution if the score is larger than 3.</p>
  <p>Any ideas?</p>
  <p>Thanks</p>