title: Merging two dataset with different lengths is throwing an Error in R
body: <p>I am trying to merge two <code>datasets/datatable</code> with different lengths but i am constantly getting the below error</p>
  
  <pre><code>Error in `[.data.table`(y, xkey, nomatch = ifelse(all.x, NA, 0), allow.cartesian = allow.cartesian) 
  
  : 
    retFirst must be integer vector the same length as nrow(i)
  </code></pre>
  
  <p>I am not able to understand what the error message means. Can someone help?
  i am using the below code to merge:</p>
  
  <pre><code>merge(x=Red,y=Error,by=c("loopN","TYPE"),all.x=TRUE)
  
  datatable data:
  </code></pre>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>DATA TABLE RED
  
      TIME        TYPE loopN diff
  11/26/2014 0:45 28808 141126 0
  11/26/2014 1:00 28808 141126 0
  11/26/2014 1:15 28808 141126 0
  11/26/2014 1:30 28808 141126 0
  11/26/2014 1:15 189379 141126 0
  11/26/2014 1:30 189379 141126 0
  11/26/2014 2:15 189379 141126 0
  11/26/2014 1:00 239188 141126 0
  11/26/2014 1:15 239188 141126 0
  11/26/2014 1:30 239188 141126 0
  11/26/2014 13:30 239188 141126 0
  
  
  DATA TABLE ERROR
  
  loopN TYPE V1
  141126 28808 -2.932
  141126 28808 -2.932
  141126 28808 -2.932
  141126 28808 -2.932
  141126 189379 1.061
  141126 189379 -1.182
  141126 189379 4.771
  141126 239188 -0.163
  141126 239188 -1.573
  141126 239188 -1.981
  141126 239188 -1.981</code></pre>
  </div>
  </div>
  </p>