title: Add columns from different data frames and stack on two indicators
body: <p>We’d like to merge some columns from a data frame with the matching columns from various different data frames. Our main data frame <em>predict</em> looks as follows:</p>
  
  <pre><code>&gt;predict
   x1    x2    x3
   1     1     1
   0     1     0
   1     1     0
   1     1     0
   0     0     1
  </code></pre>
  
  <p>(There may be more columns depending on the quantity of prediction runs)</p>
  
  <p>Our goal is to merge this data frame with the y-columns from three different <em>test</em> data frames (<em>df_1</em> <em>df_2</em> and <em>df_3</em>) which all have the same structure. The needed columns are accessed through <code>df_1$y[test]</code> ([test] is a logical vector which identifies the 5 values which match our x-values) and have the same structure as the x-columns from <em>predict</em>.</p>
  
  <p>The desired output would look like this:</p>
  
  <pre><code>&gt;predict_test
   x1    x2    x3    y1    y2    y3 
   1     1     1     1     1     1
   0     1     0     0     0     0
   1     1     0     0     1     0
   1     1     0     1     1     1
   0     0     1     0     0     1
  </code></pre>
  
  <p>In the next step we need to stack the x- and the y- columns into one column in order to do evaluations. It is important to stack them in the correct order, i.e. x2 under x1 and x3 under x2. The y-columns respectively. </p>
  
  <pre><code>&gt;predict_test_stack
   x_all y_all
   1     1
   0     0
   1     0
   1     1
   0     0
   1     1
   1     0
   1     1
   1     1
   0     0
   1     1
   0     0
   0     0
   0     1
   1     1
  </code></pre>
  
  <p>This probably works with <code>melt</code>, but we don't know how to apply it while indicating two different id variables.</p>
  
  <p>Thanks for your help.</p>