title: Merging two data frames with different length and different column level in R
body: <p>I have a problem merging two data frame with the small data frame being the priority consider the following example please:</p>
  
  <pre><code>d1 
  x  y
  
  a  4
  b  5
  c  9
  
  
  d2
  y  z
  
  5  2
  7  8
  9  3
  4  1
  6  8
  </code></pre>
  
  <p>i want to get same length as the small data frame length if y column of d1 = y column of d2 as shown below: </p>
  
  <pre><code>merged
  y  x  z
  
  4  a  1
  5  b  2
  9  c  3
  </code></pre>
  
  <p>i wrote the following codes but does not seems to work:</p>
  
  <pre><code>merged   &lt;- merge(d1, d2, by.x="y", by.y="y")
  </code></pre>
  
  <p>can any one help?</p>
  
  <p>Thank you.    </p>