[R] sorting table output

Erin Hodgess erinm.hodgess at gmail.com
Thu Oct 22 00:16:17 CEST 2009

Dear R People:

Suppose I have the following output:

> table(xx)
 A  C  G  T
13 12 10 15

I would like to have the output sorted in descending order by "height"
or frequency.

But when I do the following:

> rev(table(xx))
 T  G  C  A
15 10 12 13

the output is sorted by the names rather than the frequency.

Any suggestions, please?

Thanks in advance,

Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodgess at gmail.com

More information about the R-help mailing list