I think what follows will do the trick for matrices or data frames:
mydata <- mydata[order(mydata$var-to-be-sorted-by),]
© W. Ludwig-Mayerhofer, R Guide | Last update: 02 Aug 2016