I have read how the set function in data.table is faster than the usual DT[i, j, by] approach of assignment (:=). I am wondering whether it is possible to use the set function with a by term somehow. I'm not familiar with the set function and am finding it a tad confusing.
If anyone has any good links on using the set function, I would be grateful. I am aiming to sum counts using a condition on i as well as separately by various by columns.