Define a key that maps the necessary changes to sort "theCol":
key <- sort.list(myFrame[["theCol"]]);
And then perform the sort on every column:
for (i in 1:length(myFrame)) myFrame[["theCol"]] <-
myFrame[["theCol"]][key];
If there''s a better way, let me know.
Kevin
-----Original Message-----
From: David White [mailto:dwhite at ling.ohio-state.edu]
Sent: Friday, June 29, 2001 11:56 AM
To: r-help at stat.math.ethz.ch
Subject: [R] sorting a dataframe by a column
Hello,
Can anyone give me advice on sorting a dataframe by a given column?
Thanks,
D
S. David White
sdavidwhite at bigfoot.com
Columbus, Ohio
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._