[R] order matrix regarding its content.

Ragia Ibrahim ragia11 at hotmail.com
Sat May 23 11:10:51 CEST 2015


Dear group,
I have the following matrix

  1 2 3 4 5 6 7 8 9 10
1  0 1 1 1 1 1 1 1 1  1
2  0 0 0 1 1 0 0 0 0  0
3  0 0 0 1 1 1 1 1 1  1
4  0 0 0 0 1 0 0 0 0  0
5  0 0 0 0 0 0 0 0 0  0
6  0 0 0 0 0 0 1 1 1  1
7  0 0 0 0 0 0 0 1 1  0
8  0 0 0 0 0 0 0 0 1  0
9  1 1 1 1 1 1 1 1 1  1
10 0 0 0 0 0 0 0 0 0  0

how to order it according to ones and zeros to be ordered as if it all ones orpartially finally all zeros, like  the following or similar


9  1 1 1 1 1 1 1 1 1  1
1  0 1 1 1 1 1 1 1 1  1
3  0 0 0 1 1 1 1 1 1  1
6  0 0 0 0 0 0 1 1 1  1
2  0 0 0 1 1 0 0 0 0  0
7  0 0 0 0 0 0 0 1 1  0
4  0 0 0 0 1 0 0 0 0  0
8  0 0 0 0 0 0 0 0 1  0
5  0 0 0 0 0 0 0 0 0  0
10 0 0 0 0 0 0 0 0 0  0


thanks in advance
Ragia





 		 	   		  
	[[alternative HTML version deleted]]



More information about the R-help mailing list