title: merge and get max value from two different datatables in R
body: <p>I've 2 different data.tables. I need to merge and get max value based on a row values. The examples of two tables are given as Input below and expected output shown below.</p>
  
  <p><strong>Input</strong></p>
  
  <p><strong>Table 1</strong></p>
  
  <pre><code>X   A   B
  A   3   
  B   4   6
  C   5   
  D   9   12
  </code></pre>
  
  <p><strong>Table 2</strong></p>
  
  <pre><code>X   A   B    
  A   1   5
  B   6   8
  C   7   14
  D   5   
  E   1   1
  F   2   3
  G   5   6
  </code></pre>
  
  <p><strong>Expected Output:</strong></p>
  
  <pre><code>X   A   B
  A   3   5
  B   6   8
  C   7   14
  D   9   12
  E   1   1
  F   2   3
  G   5   6
  </code></pre>