Skip to content
Back to formatted view

Raw Message

Message-ID: <1123545900.31784.52.camel@ipc143004.lif.icnet.uk>
Date: 2005-08-09T00:04:59Z
From: Adaikalavan Ramasamy
Subject: reverse order of matrix rows
In-Reply-To: <Pine.SGI.4.40.0508081943280.10828189-100000@origin.chass.utoronto.ca>

How about simply 

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

Regards, Adai



On Mon, 2005-08-08 at 19:44 -0400, Jean Eid wrote:
> sapply(nrow(matrix):1, function(x) matrix[x,])
> 
> 
> 
> On Mon, 8 Aug 2005, Jake wrote:
> 
> > 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.?
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> >
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>