title: How to merge two data.table by different column names?
body: <p>I have two data.table <strong>X</strong> and <strong>Y</strong>.</p>
  
  <p>columns in <strong>X</strong>: <code>area, id, value</code><br>
  columns in <strong>Y</strong>: <code>ID, price, sales</code>  </p>
  
  <p>Create the two data.tables:</p>
  
  <pre><code>X = data.table(area=c('US', 'UK', 'EU'),
                 id=c('c001', 'c002', 'c003'),
                 value=c(100, 200, 300)
                )
  
  Y = data.table(ID=c('c001', 'c002', 'c003'),
                 price=c(500, 200, 400),
                 sales=c(20, 30, 15)
                )
  </code></pre>
  
  <p>And I set keys for <strong>X</strong> and <strong>Y</strong>:</p>
  
  <pre><code>setkey(X, id)
  setkey(Y, ID)
  </code></pre>
  
  <p>Now I try to join <strong>X</strong> and <strong>Y</strong> by <code>id</code> in <strong>X</strong> and <code>ID</code> in <strong>Y</strong>:</p>
  
  <pre><code>merge(X, Y)
  merge(X, Y, by=c('id', 'ID'))
  merge(X, Y, by.x='id', by.y='ID')
  </code></pre>
  
  <p>All raised error saying that column names in the <code>by</code> argument invalid.</p>
  
  <p>I referred to the manual of data.table and found the <code>merge</code> function not supporting <code>by.x</code> and <code>by.y</code> arguments.</p>
  
  <p>How could I join two data.tables by different column names <strong>without changing the column names</strong>?</p>
  
  <p><strong>Append</strong>:<br>
  I managed to join the two tables by <code>X[Y]</code>, but why <code>merge</code> function fails in data.table? </p>