title: Filtering rows which satisfy a condition per group in r
body: <p>I have a big dataframe and I want to remove all rows if the number of rows for a given group based on a column in this datafram is less than a given number.
  Here is an example:</p>
  
  <pre><code>x=1:6; y=c("A","B","B","B","C","C")
  df&lt;- data.frame(x,y)
  </code></pre>
  
  <p>If I group by variable y, I have three rows that belong to group "B". Here I want to remove all rows that don't satisfy this condition (&lt;3 rows).
  Expected output:</p>
  
  <pre><code>df
    x y
  1 2 B
  2 3 B
  3 4 B
  </code></pre>
  
  <p>Is there an easy way to do this?</p>