title: Combining two data frames into two columns in R
body: <p>I would like to combine two data frames into two columns in R:</p>
  
  <p>Here is an example of the two data frames:</p>
  
  <p>Data frame XY:</p>
  
  <pre><code> X     Y
   x1    y1
   x2    y2
   x3    y3
   x4    y4
   x5    y5
  </code></pre>
  
  <p>Data frame XZ:</p>
  
  <pre><code> X     Z
   x1    z1
   x2    z2
   x3    z3
   x4    z4
   x5    z5
  </code></pre>
  
  <p>I want the outcome to be one data frame that looks like this:</p>
  
  <pre><code> X     YZ
   x1    y1
   x2    y2
   x3    y3
   x4    y4
   x5    y5
   x1    z1
   x2    z2
   x3    z3
   x4    z4
   x5    z5
  </code></pre>
  
  <p>Here is the code in R for the sample data frames above:</p>
  
  <pre><code>x &lt;- c("x1", "x2", "x3", "x4", "x5")
  y &lt;- c("y1", "y2", "y3", "y4", "y5")
  z &lt;- c("z1", "z2", "z3", "z4", "z5")
  
  XY &lt;- data.frame(x,y)
  XZ &lt;- data.frame(x,z)
  </code></pre>
  
  <p>I've tried rbind() but haven't had much luck. Merge only merges data frames by adding columns too. I'm not really sure how to go about this.</p>