Skip to content

reverse order of matrix rows

3 messages · Jake Michaelson, Jean Eid, Adaikalavan Ramasamy

#
Quick question:  how can I reverse the order of the rows in a matrix?  
i.e. make the last row first and the first row last, etc.?
#
sapply(nrow(matrix):1, function(x) matrix[x,])
On Mon, 8 Aug 2005, Jake wrote:

            
#
How about simply 

	mat <- mat[ nrow(mat):1, ]

Regards, Adai
On Mon, 2005-08-08 at 19:44 -0400, Jean Eid wrote: