Submitted by: Sam Steingold; Assigned to: Arun ; [R-Forge link](https://r-forge.r-project.org/tracker/index.php?func=detail&aid=2722&group_id=240&atid=978) As reported [here](http://stackoverflow.com/questions/16152161/understanding-optimisation-messages-on-assignment-by-reference-in-a-data-table/). ``` S options(datatable.warnings = TRUE) dt <- data.table(a = c(rep(3, 5), rep(4, 5)), b=1:10, c=11:20, d=21:30, key="a") dt <- dt[, c(lapply(.SD,sum),.N), by=a] ``` results in an **optimisation warnings**, so I cannot discard the original table right away and have to resort to an intermediate one: ``` S dt.out <- dt[, lapply(.SD, sum), by = a] dt.out[, count := dt[, .N, by=a]$N] ```