Create a column that has the number of observations (count of rows) when performing a group with by
.
dt %<>%
.[, .(col1 = sum(col2, na.rm = TRUE),
counter = .N),
by = .(grp_col)]
See this Stack Overflow question
Create a column that has the number of observations (count of rows) when performing a group with by
.
dt %<>%
.[, .(col1 = sum(col2, na.rm = TRUE),
counter = .N),
by = .(grp_col)]
See this Stack Overflow question