# example data
DT = data.table(iris)
DT[, Bin := cut(Sepal.Length, c(4,6,8))]
Using .N
.N in j stores the number of rows in a subset. When exploring data, .N is handy to...
count rows in a group,
DT[Species == "setosa", .N]
# 50
or count rows in all groups,
DT[, .N,...