[R] Sorting

Ko-Kang Kevin Wang kwan022 at stat.auckland.ac.nz
Fri Sep 12 01:05:08 CEST 2003


On Thu, 11 Sep 2003 MZodet at ahrq.gov wrote:

> What is the best way to sort a dataframe?
> For example, how would I go about sorting a dataframe (with variables V1-V5)
> by ascending V1, V2 and descending V3 while retaining V4 and V5.


> Also, is there a relatively easy way by which to re-order my columns?

?order or ?sort



"On two occasions, I have been asked [by members of Parliament],
'Pray, Mr. Babbage, if you put into the machine wrong figures, will
the right answers come out?' I am not able to rightly apprehend the
kind of confusion of ideas that could provoke such a question."

-- Charles Babbage (1791-1871) 
---- From Computer Stupidities: http://rinkworks.com/stupid/

Ko-Kang Kevin Wang
Master of Science (MSc) Student
SLC Tutor and Lab Demonstrator
Department of Statistics
University of Auckland
New Zealand
Homepage: http://www.stat.auckland.ac.nz/~kwan022
Ph: 373-7599
    x88475 (City)
    x88480 (Tamaki)

More information about the R-help mailing list