title: Creating a list in which each list item has unique elements
body: <p>I am using a loop to create a list using the following code</p>
  
  <pre><code>for (i in 1:length(names))
  {
  a[i]&lt;-filter(global,global$people_names==names[i]) %&gt;% select(Class)
  }
  </code></pre>
  
  <p><code>names</code> is a vector and <code>global</code> is a data frame. I am comparing each element of <code>names</code> with each <code>people_names</code> and picking up the <code>Class</code>. The code works well if the values in <code>Class</code> are distinct for each <code>people_names</code>. But if a <code>people_names</code> "rocky" has classes : <code>class1</code> <code>class2</code> <code>class3</code> <code>class3</code>, I am not able to
  remove the repetitions of <code>class3</code> while populating my list. Using <code>select(unique(Class))</code> does not help. Please help.</p>