你可以[像使用一样
[
dt[, .SD[all(logic)], by = group] # group logic #1: B TRUE #2: B TRUE #3: B TRUE
我们需要使用 if
if
dt[, if(all(logic)) .SD, by = group] # group logic #1: B TRUE #2: B TRUE #3: B TRUE