title: Merging two vectors into a dataframe by an index
body: <p>I am trying to comine two data frames such that I match the values in the vectors called <code>vec</code> by their index number. I am looking for an intuitive vlookup function.</p>
  
  <pre><code>    vec=c(-2,-5)
      vec2=c(11,17)
      y1=as.data.frame(cbind(0:(length(c(vec))-1)*2+1,c(vec)))
  
        V1 V2
      1  1 -2
      2  3 -5
  
      y2=as.data.frame(cbind(0:(length(c(m$coefficients))-1)*2+2,c(vec2)))
  
         V1 V2
      1  2 11
      2  4 15
  
      x=as.data.frame(1:4,names="V1"); names(x)="V1"
  
        V1
      1  1
      2  2
      3  3
      4  4
  </code></pre>
  
  <p>What I want is a dataframe to look like this</p>
  
  <pre><code>      V1  V2
      1  1  -2
      2  2  11
      3  3  -5
      4  4  17
  </code></pre>
  
  <p>So far I was able to do the first merge</p>
  
  <pre><code>c1=merge(x, y1, all.x=TRUE)
  
    V1 V2
  1  1 -2
  2  2 NA
  3  3 -5
  4  4 NA
  </code></pre>
  
  <p>But unable to do the second with </p>
  
  <pre><code>c2=merge(c1, y2, all.x=TRUE)
  </code></pre>