title: How to (randomly) filter data.table based on other data.table
body: <p>I have two data.tables, the main one DT 30M rows 15 cols and a small one sampleUsers 50k rows 1col.
  I am trying to filter the big DT based on a random sample of unique users that I put into sampleUsers.
  <code>DT[sampleUsers]</code> <code>merge(DT,sampleUsers)</code> <code>join(DT,sampleUsers, by = "userID", type = "inner")</code> all don't work for me cause they throw an error like:</p>
  
  <pre><code>Error in  in vecseq(f__, len__, if (allow.cartesian || notjoin) NULL else as.integer(max(nrow(x),  : 
    Join results in more than 2^31 rows (internal vecseq reached physical limit). Very likely misspecified join. Check for duplicate key values in i, each of which join to the same group in x over and over again. [...]
  </code></pre>
  
  <p>DT looks like:</p>
  
  <pre><code>head(DT)
     userID       time       refURL
  1:      1 1396914606             
  2:      1 1397002826             
  3:      1 1397050230             
  4:      1 1397158818             
  5:    100 1397028490 facebook.com
  6:    100 1397028498 facebook.com
  </code></pre>
  
  <p>sampleUsers looks like:</p>
  
  <pre><code>head(sampleUsers)
                  userID  myID
  1: 1000089045463267792  8948
  2: 1000089045463267792 28029
  3: 1000226029643951569 22077
  4: 1000488257652897256 41877
  5:   10012190558163229  8065
  6: 1001364147664198715 11842
  </code></pre>
  
  <p>In DT there are approx. 10Mio unique IDs (that occur multiple times because of different timestamps. All I want to do is sample 50.000 unique Users and all their entries in DT.</p>
  
  <p>Sorry if it sounds way to trivial but I just can't find a solution.
  Help is deeply appreciated!</p>