title: How to create a column that is a group label for unique collections of other columns data table
body: <p>Surprised how hard this is to find.</p>
  
  <p>Suppose I have data table:</p>
  
  <pre><code>dat = data.table(d=c(1:3,1),k=c(3:1,3),f=1)
  
     d k f
  1: 1 3 1
  2: 2 2 1
  3: 3 1 1
  4: 1 3 1 
  </code></pre>
  
  <p>I want to groupby d,k to create a new column a that numbers the groups so I get:</p>
  
  <pre><code>   d k f a
  1: 1 3 1 1
  2: 2 2 1 2 
  3: 3 1 1 3
  4: 1 3 1 1
  </code></pre>
  
  <p>Please no workarounds, assume that d,k rows are not unique necessarily, so there might be repeats in a. </p>