.SD
.SD refers to the subset of the data.table for each group, excluding all columns used in by.
.SD along with lapply can be used to apply any function to multiple columns by group in a data.table
We will continue using the same built-in dataset, mtcars:
mtcars = data.table(mtcars) # Let's not ...