Testing if rows of a matrix or data frame are sorted in R
What is an efficient way to test if rows in a matrix are sorted?

I am porting some code that uses [`issorted(,'rows')` from Matlab](http://www.mathworks.com/help/techdoc/ref/issorted.html).  As it seems that `is.unsorted` does not extend beyond vectors, I'm writing or looking for something else.  The naive method is to check that the sorted version of the matrix (or data frame) is the same as the original, but that's obviously inefficient.  

NB: For sorting, a la [`sortrows()` in Matlab](http://www.mathworks.com/help/techdoc/ref/sortrows.html), my code essentially uses `SortedDF <- DF[do.call(order, DF),]` (it's wrapped in a larger function that converts matrices to data frames, passes parameters to `order`, etc.).  I wouldn't be surprised if there are faster implementations (data table comes to mind).
Testing if rows of a matrix or data frame are sorted in R
===

What is an efficient way to test if rows in a matrix are sorted?

I am porting some code that uses [`issorted(,'rows')` from Matlab](http://www.mathworks.com/help/techdoc/ref/issorted.html).  As it seems that `is.unsorted` does not extend beyond vectors, I'm writing or looking for something else.  The naive method is to check that the sorted version of the matrix (or data frame) is the same as the original, but that's obviously inefficient.  

NB: For sorting, a la [`sortrows()` in Matlab](http://www.mathworks.com/help/techdoc/ref/sortrows.html), my code essentially uses `SortedDF <- DF[do.call(order, DF),]` (it's wrapped in a larger function that converts matrices to data frames, passes parameters to `order`, etc.).  I wouldn't be surprised if there are faster implementations (data table comes to mind).