If .keep = TRUE (the default), the columns not mentioned in ... are also kept. However, if
a new column is created in one of the expressions therein, .keep can also be set to a character
vector containing the names of all the columns that should be in the result in addition to the
ones mentioned in .... See the examples.
The value of .n is only relevant when .keep is not FALSE. It is used to subset .SD in
the built data.table expression. For example, we could get 2 rows per combination by setting
.n to 1:2, or get the last row instead of the first by using .N. If more than one index is
used, and not enough rows are found, some rows will have NA. Do note that, at least as of
version 1.12.2 of data.table, only expressions with single indices are internally optimized.
To see more examples, check the
vignette, or the
table.express-package entry.