[R] Sorting a matrix by a column

John Sorkin jsorkin at grecc.umaryland.edu
Mon Aug 4 20:48:48 CEST 2008

R 2.6
Windows XP

I have a 100x4 matirx


I would like to sort the entire matrix by column two, i.e. data[,2]
I looked at the help page for sort() but can not determine how I can use it to sort a matrix on one of the matrix's columns.


John David Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)

Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:6}}

More information about the R-help mailing list