0

I have the following simple data.table:

   A B
1: 1 1
2: 1 1
3: 1 2
4: 1 2

Now what I want to have is simply:

   A B
1: 1 1
2: 1 2

I want to do this in data.table since it is very fast, so I try:

dt[,,by=list(A, B)]

and it does suprisingly nothing. How do I group the data.table fast together?

PS: I'm now doing this:

dt[,sum(A),by=list(A, B)]

and simply drop the last column (very inefficient imho).

Thanks!

Snowflake
  • 2,869
  • 3
  • 22
  • 44

0 Answers0