title: Condition on grouped observation in a panel dataframe
body: <p>I have a dataframe that looks like this</p>
  
  <pre><code>id year changetype
   1  2010         1
   1  2012         2
   2  2014         2
   2  2014         2
   3  2012         1
   3  2012         2
   3  2014         2
   3  2014         1
  </code></pre>
  
  <p>I want to get something like this</p>
  
  <pre><code>id year changetype
   1  2010         1
   1  2012         2
   2  2014         2
   2  2014         2
  </code></pre>
  
  <p>In other words I want to remove all observations associated with id 3 because, in the same year (2012) id=3 presents both changetype=1 and changetype=2.</p>
  
  <p>How can I impose a condition on variable for grouped observation by id and year?
  Many thanks to everyone helping me.</p>