I can add a new column to a data.table like this:
DT = data.table(A=sample(3, 10, TRUE),
B=sample(letters[1:3], 10, TRUE), C=sample(10))
DT[, new:=1:10]
But is there a clever way to set it to the start of the data.table? - I know i can do it with setcolorder, but I would like to avoid that.
setcolorder(DT, c("new", "A", "B", "C"))