I could not find anything in the documentation about how
DT <- data.table (a = 1)
DT[a==1][, b:=1]
is actually different from
DT <- data.table (a = 1)
DT1 <- DT[a==1]
DT1[, b := 1]
Maybe the distinction should be written somewhere. This behavior surprised me.