[R] rank in descending order?

Jose Quesada quesada at gmail.com
Wed Dec 1 23:16:10 CET 2004


Hi,

Is there any simple solution to get ranks in descending order?
Example, 
a <- c(10, 98, 98, 98, 99, 100)
r <- rank(a, ties.method="average")

produces
1 3 3 3 5 6

I would want this instead:
6 5 3 3 3 1

Note that reversing r doesn't work but in small examples.

Thanks,
-Jose

-- 
 
jquesada at andrew.cmu.edu		Research associate
http://lsa.colorado.edu/~quesadaj	Dept. of Social and Decision Sciences
http://www.andrew.cmu.edu/~jquesada	Carnegie Mellon University
Porter Hall	Phone: 412 268 6011
office PH208-J	Fax:   412 268 6938
5000 Forbes ave.
15213, Pittsburgh, PA




More information about the R-help mailing list