I have a data.table dumdt:
data.table
dumdt
set.seed(123) dumdt <- data.table(v1=sample(1:10, 5), v2=1:5)
whose rows I\'d like to r
If I understand correctly, you can just add a col and then order by it:
setorder(dumdt[, .r := order(to_ord)], .r)[, .r := NULL] v1 v2 1: 4 3 2: 6 5 3: 8 2 4: 3 1 5: 7 4