Skip to content
Back to formatted view

Raw Message

Message-ID: <DUB125-W505E345B0446A1728391D5B3FE0@phx.gbl>
Date: 2015-04-06T17:18:02Z
From: Ragia Ibrahim
Subject: sort adjacency  matrix
In-Reply-To: <DUB125-W30FC1464FDF72FC398C908B3680@phx.gbl>

Dear group 
i have the following matrix

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

I want to sort it according to ones in each row ascending (where max number of ones first)

to be as follow

3  1 . . . 1 . . 1 . 1
10 . . 1 . 1 . . 1 1 .
6  1 . . 1 . . . . 1 .8  . . 1 . . . 1 . . 11  . . 1 . . 1 . . . .5  . . 1 . . . . . . 17  . 1 . . . . . 1 . .9  . . . . . 1 . . . 12  . . . . . . 1 . . .4  . . . . . 1 . . . .

how can I do this in R
thanks in advance
 		 	   		  
	[[alternative HTML version deleted]]