title: Find groups that contain all elements, but do not overlap
body: <p>I've been given a set of country groups and I'm trying to get a set of mutually exclusive regions so that I can compare them. The problem is that my data contains several groups, many of which overlap. How can I get a set of groups which contain all countries, but do not overlap with each other?</p>
  
  <p>For example, assume that this is the list of countries in the world:</p>
  
  <pre><code>World &lt;- c("Angola", "France", "Germany", "Australia", "New Zealand")
  </code></pre>
  
  <p>Assume that this is my set of groups:</p>
  
  <pre><code>df &lt;- data.frame(group = c("Africa", "Western Europe", "Europe", "Europe", "Oceania", "Oceania", "Commonwealth Countries"), 
             element = c("Angola", "France", "Germany", "France", "Australia", "New Zealand", "Australia"))
  
                     group     element
  1                 Africa      Angola
  2         Western Europe      France
  3                 Europe     Germany
  4                 Europe      France
  5                Oceania   Australia
  6                Oceania New Zealand
  7 Commonwealth Countries   Australia
  </code></pre>
  
  <p>How could I remove overlapping groups (in this case Western Europe) to get a set of groups that contains all countries like the following:</p>
  
  <pre><code>df_solved &lt;- data.frame(group = c("Africa", "Europe", "Europe", "Oceania", "Oceania"),
                          element = c("Angola", "France", "Germany", "Australia", "New Zealand"))
  
      group     element
  1  Africa      Angola
  2  Europe      France
  3  Europe     Germany
  4 Oceania   Australia
  5 Oceania New Zealand
  </code></pre>