My data.table consists of an a priori unknown number of columns, eg.
DT <- data.table("columnPred" = c(1,2,3),
"column1" = c(7,8,9),
"column2" = c(44,55,66))
I would like to calculate the change between the columns, ie.
DT[, delta1 := ((columnPred/column1)-1)*100]
DT[, delta2 := ((column1/column2)-1)*100]
How can I do this when the number of columns is unknown ahead of time?