title: Why use as.factor() instead of just factor()
body: <p>I recently saw Matt Dowle write some code with <code>as.factor()</code>, specifically</p>
  
  <pre><code>for (col in names_factors) set(dt, j=col, value=as.factor(dt[[col]]))
  </code></pre>
  
  <p>in <a href="https://stackoverflow.com/questions/7813578/convert-column-classes-in-data-table#comment31200110_20808945">a comment to this answer</a>.</p>
  
  <p>I used this snippet, but I needed to explicitly set the factor levels to make sure the levels appear in my desired order, so I had to change</p>
  
  <pre><code>as.factor(dt[[col]])
  </code></pre>
  
  <p>to</p>
  
  <pre><code>factor(dt[[col]], levels = my_levels)
  </code></pre>
  
  <p>This got me thinking: what (if any) is the benefit to using <code>as.factor()</code> versus just <code>factor()</code>?</p>