title: Merge/replace row name with colmn value from another data frame
body: <p>I have two data frames</p>
  
  <pre>
  >cat a1.txt 
  "501" 5.7916 6.9861 
  "502" 24.9444 18.45
  "503" 4 4.7222 5.5 
  "505" 5 5.2777 5.3
  
  >cat a2.txt
  501 "alex"
  502 "brian"
  503 "romeo"
  504 "tango"
  505 "zee"
  </pre>
  
  <p>I want to be able to replace the first column in a1.txt, with corresponding value from a2.txt(lookup)</p>
  
  <p>I want something like-</p>
  
  <pre>
  alex 5.7916 6.9861 
  brian 24.9444 18.45
  romeo 4 4.7222 5.5 
  zee 5 5.2777 5.3
  </pre>
  
  <p>I tried-</p>
  
  <pre><code>a1t &lt;- read.table('a1.txt')
  a2t &lt;- read.table('a2.txt')
  
  a1t
  
     V1      V2      V3
  1 501  5.7916  6.9861
  2 502 24.9444 18.4500
  3 503  4.0000  4.7222
  4 505  5.0000  5.2777
  &gt; a2t
    V1    V2
  1 501  alex
  2 502 brian
  3 503 romeo
  4 504 tango
  5 505   zee
  &gt; merge(x=a1t, y=a2t,by='V1', all.x=TRUE)
     V1    V2.x      V3  V2.y
   1 501  5.7916  6.9861  alex
   2 502 24.9444 18.4500 brian
   3 503  4.0000  4.7222 romeo
   4 505  5.0000  5.2777   zee
  </code></pre>
  
  <p>But this does not replace the 1st column. It adds one extra column.
  How can I get the above mentioned desired format?</p>
  
  <p>What if my a1.txt is unbalanced? i.e. the number of columns in it are not consistent in all rows? </p>