It is a little more subtle. This is how I read your question and how you are trying to do it at the moment ...
Your first row creates a new object data.tablewith a 6-column subset of columns:
foo = DT[, 5:10, with=F]
I immediately think about the implications for memory. If each column is 1 GB, then the new selected object is 6 GB in size.
then you are +1 to everything in this 6GB:
foo = foo + 1
This is a copy of this 6 GB to another new 6 GB.
6GB foo , DT, :
DT[, 5:10, with=F] = foo
. .
data.table , set. .
for (col in 5:10)
set(DT, j=col, value=DT[[col]]+1)
. DT[[col]] ( data.table, R, ). +1 . , , , , +1 .