title: Q: Distinction between levels() and unique() for zero-length strings in data frame
body: <p>If a column in a data frame contains a zero-length string, passing it to the levels() function will return the zero-length string.  However, unique() will not.  This seems counter-intuitive to me, and I haven't been able to find any documentation that explains this.  Does anyone know why this is the case?</p>
  
  <p>Example:</p>
  
  <pre><code>d &lt;- data.frame( col1 = c("", 'a', 'b'))  # Contains "".
  </code></pre>
  
  <p>Call unique():</p>
  
  <pre><code>unique(d$col1)
  </code></pre>
  
  <p>unique() does not return the zero-length string element:</p>
  
  <pre><code>[1]   a b
  Levels:  a b  
  </code></pre>
  
  <p>levels() includes "" in the results:</p>
  
  <pre><code>levels(d$col1)
  [1] ""  "a" "b"
  </code></pre>