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
  • 361
  • 1
  • 8

1 Answers1

1

We could change the order with mixedorder from gtools

library(data.table)
library(gtools)
dt2 <- dt1[mixedorder(subject)]
akrun
  • 874,273
  • 37
  • 540
  • 662