id <- rep(sample(1:5), each = 2) # units in a shuffled, unsorted order
t <- rep(c(2, 1), 5) # each unit's own periods out of time order
dta <- data.frame(id = id, t = t, y = rnorm(10))
dta <- sort_panel(dta, idname = "id", tname = "t")
Run the code above in your browser using DataLab