I'm proposing to have setcolorder(x) set the columns in the order specified by the keys, then remaining index columns, then the rest of the columns. I have a fork with the change already. Not sure if it would be welcome though. It makes for a nice mindless but sensible ordering to the data.
DT = data.table(a = 1:3, b = 2:4, c = 3:5)
setkey(DT, c)
setindex(DT, b)
all.equal(names(setcolorder(DT)), c("c", "b", "a"))
Forked branch available here master...jsams:colorder_keys
Happy to make a PR if this is something that would be welcome (and sorry for the tracker spam the past few hours). Tried setting up the tests and such, but really, I have no idea what's going on with the testing framework here to be honest.
I'm proposing to have
setcolorder(x)set the columns in the order specified by the keys, then remaining index columns, then the rest of the columns. I have a fork with the change already. Not sure if it would be welcome though. It makes for a nice mindless but sensible ordering to the data.Forked branch available here master...jsams:colorder_keys
Happy to make a PR if this is something that would be welcome (and sorry for the tracker spam the past few hours). Tried setting up the tests and such, but really, I have no idea what's going on with the testing framework here to be honest.