Sorting of columns of a matrix
Perhaps you could supply the matrix using dput() ? It is a handy way to supply sample data. Just do dput(mydata), copy the results and paste into email. At the moment your matrix is almost unreadable. John Kane Kingston ON Canada
-----Original Message----- From: nicomet80 at gmail.com Sent: Wed, 29 Aug 2012 15:24:17 +0200 To: r-help at r-project.org Subject: [R] Sorting of columns of a matrix Dear all, Please suggest me how can I do it. I have a matrix which look like following: x1 x2 x3 t1 .01 0.3 0 t2 0 0.1 0.01 t3 0 .01 .01 t4 0 0 t5 5 0 0 t6 0 0 0 t7 0 0 0 t8 0 0 0 t9 0.6 0 0 t10 0 0 0.66 t11 0 0.6 0.11 t12 0 0.4 0 I want to sort decreasing order in each column based on rows. and then to display only those rows which has a value. The expected out put matrix will look like x1 x2 x3 t9 0.6 t11 0.6 t10 0.66 t1 .01 t12 0.4 t11 0.11 t1 0.3 t2 .01 t2 0.1 t3 .01 many thanks Nico [[alternative HTML version deleted]]
______________________________________________ R-help at 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.
____________________________________________________________ FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family! Visit http://www.inbox.com/photosharing to find out more!