Using by with set function in data.table

Hi there,
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.


set() cannot be used with by grouping.

This may be too obvious but ?set provides some examples. The authors also contribute to Stackoverflow where examples are discussed.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.