Skip to content
Prev 8944 / 398502 Next

sorting ascending descending! & THX@coling

Thomas Vogels <tov at ece.cmu.edu> writes:
It is, but the sign trick generalizes to multiple sort criteria:

d[order(d$sex,-d$year,-rank(d$ch)),]

(assuming that d$ch is a character vector which you want to sort by in
reverse alphabetical order).