Hello,
Suppose I have a matrix a where

a=              sp1     sp2     sp3     sp4     sp5     sp6
        site1   1       0       1       1       0       1
        site2   1       0       1       1       0       1
        site3   1       1       1       1       1       1
        site4   0       1       1       1       0       1
        site5   0       0       1       0       0       1
        site6   0       0       1       0       1       0

And I want to pack that matrix so that the upper left corner contains
most of the ones and the bottom right corner contains most of the zeros
so that matrix b is

b=              sp3     sp6     sp4     sp1     sp2     sp5
        site1   1       1       1       1       0       0
        site2   1       1       1       1       0       0
        site3   1       1       1       1       1       1
        site4   1       1       1       0       1       0
        site5   1       1       0       0       0       0
        site6   1       0       0       0       0       1

Can any of you help me with some code to accomplish this?  I have tried
different forms of order and can't seem to figure it out.  Basically I
want to order the matrix by both the rows and columns.

Thank you for your help.
Cam

Cameron Guenther, Ph.D. 
Associate Research Scientist
FWC/FWRI, Marine Fisheries Research
100 8th Avenue S.E.
St. Petersburg, FL 33701
(727)896-8626 Ext. 4305
[EMAIL PROTECTED]

______________________________________________
R-help@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
and provide commented, minimal, self-contained, reproducible code.

Reply via email to