title: Extract number of unique values in a data frame column
body: <p>Giving the following data:</p>
  <pre><code>sample &lt;- c(rep(&quot;A&quot;,5),rep(&quot;B&quot;,7),rep(&quot;C&quot;,4),rep(&quot;D&quot;,9))
  species &lt;- sample(x = c(&quot;sp1&quot;, &quot;sp2&quot;,&quot;sp3&quot;,&quot;sp4&quot;,NA), size = 25, replace = TRUE)
  data &lt;- data.frame(sample,species)
  </code></pre>
  <p>How can I extract the number of unique values in species by sample (A,B,C...)?</p>