Many thanks > Date: Sat, 23 May 2015 11:55:07 +0200 > From: lig...@statistik.tu-dortmund.de > To: ragi...@hotmail.com; r-help@r-project.org > Subject: Re: [R] order matrix regarding its content. > > > > On 23.05.2015 11:10, Ragia Ibrahim wrote: > > 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 > > > X[order(-rowSums(X)),] > > Best, > Uwe Ligges > > > > > > > 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]] > > > > ______________________________________________ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > 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. > > [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.