title: invalid factor level, NA generated when pasting in a dataframe in r
body: <p>I cannot paste the correct data into the dataframe using rbind. Here is the problem</p>
  
  <pre><code>Results &lt;- dataframe()
  </code></pre>
  
  <p>Value will store the hospital name that meets the selection criteria and y[1,2] is the name of the State</p>
  
  <p>Here is what I get when I try to past the results into the blank dataframe results.</p>
  
  <pre><code>class(results)
  [1] "data.frame"
  value
  [1] "JOHN C LINCOLN DEER VALLEY HOSPITAL"
  y[1,2]
  [1] "AZ"
  class(value)
  [1] "character"
  class(y[1,2])
  [1] "character"
  results &lt;- rbind(results,as.list(c(value,y[1,2])))
  Warning messages:
  1: In `[&lt;-.factor`(`*tmp*`, ri, value = "JOHN C LINCOLN DEER VALLEY HOSPITAL") :
    invalid factor level, NA generated
  2: In `[&lt;-.factor`(`*tmp*`, ri, value = "AZ") :
    invalid factor level, NA generated
  results
    X.ARKANSAS.METHODIST.MEDICAL.CENTER. X.AR.
  1    ARKANSAS METHODIST MEDICAL CENTER    AR
  2                                 &lt;NA&gt;  &lt;NA&gt;
  3                                 &lt;NA&gt;  &lt;NA&gt;
  </code></pre>
  
  <p>How to solve this?
  Many thanks</p>