title: Merge data frames as a function
body: <p>As a newbie user of R, I would like to understand how can I write a function that takes multiple 2 dataframes and returns the merge of it. I tried with :  </p>
  
  <pre><code> mer&lt;-function(df1 , df2){
     zz &lt;- merge(df1, df2,by.x = wt,by.y= wt, all = TRUE)
     zz[is.na(zz)] &lt;- 0
     return(zz)
   }
  </code></pre>
  
  <p>But the error I get is</p>
  
  <blockquote>
    <p>Error in fix.by(by.y, y) : 'by' must match numbers of columns</p>
  </blockquote>