title: R factor NA vs <NA>
body: <p>I have the following data frame:</p>
  
  <pre><code>df1 &lt;- data.frame(id = 1:20, fact1 = factor(rep(c('abc','def','NA',''),5)))
  df1
     id fact1
  1   1   abc
  2   2   def
  3   3    NA
  4   4      
  5   5   abc
  6   6   def
  7   7    NA
  8   8      
  9   9   abc
  10 10   def
  11 11    NA
  12 12      
  13 13   abc
  14 14   def
  15 15    NA
  16 16      
  17 17   abc
  18 18   def
  19 19    NA
  20 20      
  </code></pre>
  
  <p>I'm trying to standardize all the missing values ('' and NA's) to become NA's.  However when I use this:</p>
  
  <pre><code>df1[df1 == ''] &lt;- NA
  </code></pre>
  
  <p>there seems to be 2 classes of NA's.  </p>
  
  <pre><code>df1
     id fact1
  1   1   abc
  2   2   def
  3   3    NA
  4   4  &lt;NA&gt;
  5   5   abc
  6   6   def
  7   7    NA
  8   8  &lt;NA&gt;
  9   9   abc
  10 10   def
  11 11    NA
  12 12  &lt;NA&gt;
  13 13   abc
  14 14   def
  15 15    NA
  16 16  &lt;NA&gt;
  17 17   abc
  18 18   def
  19 19    NA
  20 20  &lt;NA&gt;
  </code></pre>
  
  <p>Is there a best-practices method for dealing with this situation?</p>