0

I have a data.table with structure like this. Can I re-order the row by subject number as subject 1, subject 2, subject 3, with number from low to high?

enter image description here

Kenny
  • 351
  • 1
  • 8

1 Answers1

1

We could change the order with mixedorder from gtools

library(data.table)
library(gtools)
dt2 <- dt1[mixedorder(subject)]
akrun
  • 789,025
  • 32
  • 460
  • 575