Alternatively, if you want to sort first on aaa$a and second on aaa$b, then try the following:

aaa[order(aaa$a, aaa$b),]

hope this helps. spencer graves

Stefano Calza wrote:
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

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to