title: Using duplicated as a filter with dplyr by the number of inputs
body: <p>I'am currently using the following line of code to filter a dataframe based on two variables and two conditions. </p>
  
  <pre><code>df %&gt;% filter(v1 %in% c('value1', 'value2')) %&gt;% 
          filter(v2 %in% v2[duplicated(v2)])
  </code></pre>
  
  <p>In my dataset, v1 consists of multiple tags and v2 consists of user_ids. A single user_id in v2 can have multiple tags (in v1) looking as follows: </p>
  
  <pre><code>v1      v2 
  html    piet
  c#      piet 
  c#      klaas
  html    klaas
  python  klaas
  </code></pre>
  
  <p>when I use the line of code that I'm currently working with it will do the job just fine when I use just two values e.g. <code>df %&gt;% filter(v1 %in% c('c#', 'html')) %&gt;% filter(v2 %in% v2[duplicated(v2)])</code> will nicely return: </p>
  
  <pre><code>v1      v2 
  html    piet
  c#      piet 
  c#      klaas
  html    klaas
  </code></pre>
  
  <p>But when using three values in the first filter e.g. <code>df %&gt;% filter(v1 %in% c('c#', 'html', 'python')) %&gt;% filter(v2 %in% v2[duplicated(v2)])</code> it also returns the values of piet while I actually want it to return only the values of klaas as follows: </p>
  
  <pre><code>v1      v2 
  c#      klaas
  html    klaas
  python  klaas
  </code></pre>
  
  <p>How do I make this happen? </p>