[R] How to sort a dataframe?

Remko Duursma den.duurs at lycos.com
Mon Apr 7 19:51:16 CEST 2003


Dear R-helpers,

for the purpose of plotting a dataframe, i am trying to sort a dataframe by one column, for example

tester <- data.frame(one=c(3,2,1), two=c(2,3,1))

#> tester
#  one two
#1   3   2
#2   2   3
#3   1   1

# I want to sort "tester" by column "one", so that i get a dataframe
# that looks like:
#one two
#1    1
#2    3
#3    2

I know of 'sort' but it can only sort vectors.

Thanks for your help,

Remko Duursma



More information about the R-help mailing list