3 ms·
Your code golf example makes no sense. B_mean <- dt[, mean(b)] Dt[b<b_mean, by=.(a)] Unlike the dplyr solution the dt solution is robust and we can i
by nojito 5y ago
Your code golf example makes no sense.
B_mean <- dt[, mean(b)]
Dt[b<b_mean, by=.(a)]
Unlike the dplyr solution the dt solution is robust and we can independently test to make sure the mean of b makes sense.
The very easy to reason around concept of dt[rows, columns, groups] makes the code extremely clear.
Your translation example is absolutely bonkers because it’s trying to pigeonhole the simplicity of dt into the nonsense that is dplyr.