title: Find the intersection of grouped variables of a data frame in R
body: <p>I have a data frame like this:</p>
  
  <pre><code>df &lt;- data.frame(
    names = c(rep("cody", 10), rep("sam", 5)),
    year  = c(paste0("year",2000:2009), paste0("year",2000:2004))
  )
  </code></pre>
  
  <p>I would like to get a resulting output like this:</p>
  
  <pre><code>df2 &lt;- data.frame(
    names = c(rep("cody", 5), rep("sam", 5)), 
    year  = c(paste0("year",2000:2004), paste0("year",2000:2004))
  )
  </code></pre>
  
  <p>Any ideas? </p>