title: How can I merge multiple dataframes with the same column names?
body: <h3>What I have:</h3>
  
  <p>I have a "master" dataframe that has the following columns:</p>
  
  <pre><code>userid, condition
  </code></pre>
  
  <p>Since there are four experiment conditions, I also have four dataframes that carry answer information, with the following columns:</p>
  
  <pre><code>userid, condition, answer1, answer2
  </code></pre>
  
  <p>Now, I'd like to join these, so all combinations of user IDs, conditions and their answers to these conditions are merged. Each condition should only have the correct answer in the appropriate column, per row.</p>
  
  <hr>
  
  <h3>Short, self-contained example:</h3>
  
  <pre><code>master = data.frame(userid=c("foo","foo","foo","foo","bar","bar","bar","bar"), condition=c("A","B","C","D","A","B","C","D"))
  cond_a = data.frame(userid=c("foo","bar"), condition="A", answer1=c("1","1"), answer2=c("2","2"))
  cond_b = data.frame(userid=c("foo","bar"), condition="B", answer1=c("3","3"), answer2=c("4","4"))
  cond_c = data.frame(userid=c("foo","bar"), condition="C", answer1=c("5","5"), answer2=c("6","6"))
  cond_d = data.frame(userid=c("foo","bar"), condition="D", answer1=c("7","7"), answer2=c("8","8"))
  </code></pre>
  
  <p>How do I merge all conditions into the master, so the master table looks like follows? </p>
  
  <pre><code>  userid condition answer1 answer2
  1    bar         A       1       2
  2    bar         B       3       4
  3    bar         C       5       6
  4    bar         D       7       8
  5    foo         A       1       2
  6    foo         B       3       4
  7    foo         C       5       6
  8    foo         D       7       8
  </code></pre>
  
  <p>I've tried the following:</p>
  
  <pre><code>temp = merge(master, cond_a, all.x=TRUE)
  </code></pre>
  
  <p>Which gives me:</p>
  
  <pre><code>  userid condition answer1 answer2
  1    bar         A       1       2
  2    bar         B    &lt;NA&gt;    &lt;NA&gt;
  3    bar         C    &lt;NA&gt;    &lt;NA&gt;
  4    bar         D    &lt;NA&gt;    &lt;NA&gt;
  5    foo         A       1       2
  6    foo         B    &lt;NA&gt;    &lt;NA&gt;
  7    foo         C    &lt;NA&gt;    &lt;NA&gt;
  8    foo         D    &lt;NA&gt;    &lt;NA&gt;
  </code></pre>
  
  <p>But as soon as I do this…</p>
  
  <pre><code>merge(temp, cond_b, all.x=TRUE)
  </code></pre>
  
  <p>There are no values for condition <code>B</code>. How come?</p>
  
  <pre><code>  userid condition answer1 answer2
  1    bar         A       1       2
  2    bar         B    &lt;NA&gt;    &lt;NA&gt;
  3    bar         C    &lt;NA&gt;    &lt;NA&gt;
  4    bar         D    &lt;NA&gt;    &lt;NA&gt;
  5    foo         A       1       2
  6    foo         B    &lt;NA&gt;    &lt;NA&gt;
  7    foo         C    &lt;NA&gt;    &lt;NA&gt;
  8    foo         D    &lt;NA&gt;    &lt;NA&gt;
  </code></pre>