Grouping with the data.table package is done using the syntax dt[i, j, by]
Which can be read out loud as: "Take dt, subset rows using i, then calculate j, grouped by by." Within the dt statement, multiple calculations or groups should be put in a list. Since an alias for list() is .(), bo...