title: Creating empty data frame with stringsAsFactors = FALSE
body: <p>I am trying to create an empty data frame where the data will be strings and with stringsAsFactors set to FALSE.  It seems that when I do that, though, it does not remember the value of stringsAsFactors.  </p>
  
  <p>It works if I create a blank row, like this:</p>
  
  <pre><code>&gt; df &lt;- data.frame(a="", b="", stringsAsFactors=FALSE)
  &gt; new.row &lt;- c("a", "z")
  &gt; df &lt;- rbind(df, new.row)
  &gt; df
    a b
  1    
  2 a z
  &gt; df[2,1] &lt;- "q"
  &gt; df
    a b
  1    
  2 q z
  </code></pre>
  
  <p>But, I want an empty data frame.  When I do that, though, it treats the strings that I later add as factors:</p>
  
  <pre><code>&gt; df2 &lt;- data.frame(a=character(), b=character(), stringsAsFactors=FALSE)
  &gt; df2 &lt;- rbind(df2, new.row)
  &gt; df2
    X.a. X.z.
  1    a    z
  &gt; df2[2,1] &lt;- "q"
  Warning message:
  In `[&lt;-.factor`(`*tmp*`, iseq, value = "q") :
    invalid factor level, NA generated
  </code></pre>
  
  <p>How can I create the empty data frame without string factors?</p>