[R] how to sort columns in a matrix?

Stefano Calza stecalza at tiscali.it
Wed Jul 9 17:56:33 CEST 2003


On Wed, Jul 09, 2003 at 05:39:31PM +0200, David Andel wrote:

Hi,

if you want to sort in alphabical order the columns of the matrix you colud do this

aaa <- aaa[,sort(colnames(aaa))]

Is it what you want?

HIH,

Stefano

> Hi
> 
> I am struggling in finding a way to sort columns in a matrix. Can anyone help me, please?
> 
> Thanks a lot,
> David
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list