title: cartesian join two R data.table and take the minimum
body: <p>I have two data.table R objects in R, streets and crashes. Below the descriptions:</p>
  
  <pre><code>head(streets)
    link_id      Lat     Long
  1:  706815684 44.13163  9.84736
  2:  572513298 46.87760 15.77544
  3:  974462021 41.86439 16.04506
  4:  906821226 43.30472 11.59198
  5:  537724528 46.30359  7.59026
  6: 1062652524 44.83993 19.08552
  </code></pre>
  
  <p>and</p>
  
  <pre><code>head(crashes)
  ID_SX      Lat     Long
  1: rca89123 45.35955  9.64950
  2: rca89654 37.07544 15.28659
  3: rca83674 44.42947  8.89526
  4: lcg55792 38.08756 13.53466
  5: lcg11992 41.81531 12.45126
  6: iix21744 38.02655 12.88128
  </code></pre>
  
  <p>I would like to attach to crashes data set the link_id from the street data.framewhere is min the havesine distance (from R geospere package): </p>
  
  <p>I was trying to use this code snippet, but it failed:</p>
  
  <pre><code>temp=crashes[streets(hdist=geosphere::distm(c(x.Long,x.Lat),c(i.Long,i.Lat),fun=distHaversine)),allow.cartesian=T]
  </code></pre>
  
  <p>Please note that streets data set is quite big (around 9Mln rows), whilst crashes is quite small (about 400 rows). I believe that, within R, only data.table could handle this efficenttly bu ti don't know how...</p>
  
  <p>Thanks in advance for the support</p>