I have a data.table like this
dput(DT) structure(list(ref = c(3L, 3L, 3L, 3L), nb = 12:15, i1 = c(3.1e-05, 0.044495, 0.82244, 0.322291), i2 = c(0.000183, 0.1
Use .SDcols to specify the columns, then take rowSums. Use := to assign new columns:
.SDcols
rowSums
:=
DT[ ,sum := rowSums(.SD), .SDcols = grep("i", names(DT))]