You can order each matrix by any column you choose like:

a<-matrix(rnorm(20),ncol=2)
> a[order(a[,1]),] #orders by column 1
             [,1]       [,2]
 [1,] -1.86523489 -1.6920270
 [2,] -0.94488744  0.2815087
 [3,]  0.02380494  0.2491136
 [4,]  0.37295795  0.8156993
 [5,]  0.55533366 -0.7053233
 [6,]  0.79799294 -0.8224082
 [7,]  0.80497452  0.4260842
 [8,]  1.12438976 -0.1567863
 [9,]  1.29213037 -1.6783762
[10,]  1.33496542  0.7807943

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to