0
> SS
   Cust_map Merch_Map_final TXN_MTH        SPND_CATGY NumTrans
1:        1            2412  201310 BUSINESS SERVICES        2
2:        1            2412  201401 BUSINESS SERVICES        3
3:        1            2412  201403 BUSINESS SERVICES        3
4:        1            2412  201406 BUSINESS SERVICES        3
5:        1            2412  201407 BUSINESS SERVICES        2
6:        2            2415  201310  GROCERY                 5
David Arenburg
  • 91,361
  • 17
  • 137
  • 196
sandy
  • 11
  • 4

1 Answers1

0

We can group by 'Cust_map' and get the sum of 'NumTrans'

SS[, .(NumTrans = sum(NumTrans)), by = Cust_map]
David Arenburg
  • 91,361
  • 17
  • 137
  • 196
akrun
  • 874,273
  • 37
  • 540
  • 662