title: R rbind dataframes returns a list
body: <p>I have run into a problem and managed to solve it with a hack and I wish to understand the problem and hopefully get rid of the hack.</p>
  
  <p>I tried recreating the problem to no avail, so words will have to suffice here.</p>
  
  <p>I am trying to <code>rbind</code> two dataframes in R, <strong>the result of which must again be a dataframe, not a list</strong>. I use <code>rbind</code> in most of my scripts and have never had an issue before.</p>
  
  <p>However, today I applied rbind to two dataframes, say <code>foo</code> and <code>bar</code> and it returned a <code>list</code> <code>foobar</code>. The hack I use to fix this is to force-convert <code>foo</code> and <code>bar</code> to dataframes <em>again</em> as follows:</p>
  
  <p><code>rbind(data.frame(foo), data.frame(bar))</code> </p>
  
  <p>This works, but I would like to know why I have to convert it explicitly when both <code>foo</code> and <code>bar</code> are already data.frames.</p>
  
  <p>My question is then in what 'general' scenarios would <code>rbind</code> return a <code>list</code> when both inputs are data.frames?</p>
  
  <p>I tried debugging it by looking at <code>rbind(A,A)</code> and <code>rbind(B,B)</code>. Both times it returns a dataframe and not a <code>list</code>. Why then would <code>rbind(A,B)</code> return a <code>list</code>?</p>
  
  <p>Thanks!</p>