title: How to efficiently count unique (numeric) column vectors of a data.table?
body: <pre><code>foo &lt;- data.table(x = 1:5/sum(1:5),
                    y = (-4):0/sum((-4):0),
                   z1 = 2:6/sum(2:6),
                   z2 = 2:6/sum(2:6))
  </code></pre>
  
  <p>Suppose I have the <code>foo</code> data table (as specified above):</p>
  
  <pre><code>            x   y   z1   z2
  1: 0.06666667 0.4 0.10 0.10
  2: 0.13333333 0.3 0.15 0.15
  3: 0.20000000 0.2 0.20 0.20
  4: 0.26666667 0.1 0.25 0.25
  5: 0.33333333 0.0 0.30 0.30
  </code></pre>
  
  <p>How to efficiently count unique columns? In this case only 3.</p>
  
  <p>Please assume that in general:</p>
  
  <ol>
  <li><code>foo</code> is always a data table and not a matrix; though the columns are always numeric.</li>
  <li><code>foo</code> in reality is big, nrow > 20k and ncol > 100</li>
  </ol>
  
  <p>Is it possible to do this without making extra copies of the data?</p>
  
  <p>My current approach is to <code>apply</code> over columns with <code>paste</code> to get a single value for each column and then do <code>length(unique(.))</code> on the result...</p>
  
  <p>Is there any magic with <code>data.table::transpose()</code>, <code>data.table::uniqueN</code>, and maybe some other friends?</p>