title: How to prevent merge from reordering columns
body: <p>In the following example</p>
  
  <pre><code>x &lt;- data.frame(code = 7:9, food = c('banana', 'apple', 'popcorn'))
  y &lt;- data.frame(food = c('banana', 'apple', 'popcorn'),
                  isfruit = c('fruit', 'fruit', 'not fruit'))
  </code></pre>
  
  <p>I would like to do <code>x &lt;- merge(x, y)</code>, but the problem is that <code>merge()</code> reorders the columns so that the <code>by</code> column (food) comes first. <strong>How can I prevent this and have <code>merge(x, y)</code> use the same column order of x and just insert the new variable (isFruit) as the third column (i.e., "code, food, isFruit" instead of "food, code, isFruit")?</strong></p>
  
  <p>I've tried this, to no avail:</p>
  
  <pre><code>merge(x, y, sort = F)
  </code></pre>
  
  <p>My workaround is to do this afterward</p>
  
  <pre><code>x &lt;- x[c(2, 1, 3)]
  </code></pre>