title: extracting unique rows of data using dplyr
body: <p>I'm trying to extract only the rows when <code>b</code> is unique value per <code>a</code>.</p>
  
  <p>Here is some sample data</p>
  
  <pre><code>a &lt;- c(1,1,2,2,3,3,4,4,5,5,5,6,6,7,7,8,8,9,9,9,9,9,10,10,10)
  b &lt;- c(1,2,1,1,5,5,6,1,1,1,3,2,2,1,1,2,3,1,2,3,4,4,1,2,2)
  df1 &lt;- data.frame(a, b)
  </code></pre>
  
  <p>and using the <code>dplyr</code> package</p>
  
  <pre><code>library(dplyr)
  
  Unique &lt;- df1 %&gt;%
    group_by(a) %&gt;%
    filter(n_distinct(b))
  </code></pre>
  
  <p>The desired output should be a data frame length 18</p>