Ordering of the data.frame by column index:
> df <- data.frame(5:9, 8:4)
> df
X5.9 X8.4
1 5 8
2 6 7
3 7 6
4 8 5
5 9 4
> df[order(df[,2]),]
X5.9 X8.4
5 9 4
4 8 5
3 7 6
2 6 7
1 5 8
or by column name:
> df[order(df[,"X5.9"]),]
X5.9 X8.4
1 5 8
2 6 7
3 7 6
4 8 5
5 9 4
Is it possible to achieve the same with data.table and order by custom column name or index?