On Wed, 1 Dec 2004, Jose Quesada wrote:

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

What does that correspond to (why are 98 and 99 ranked the same)? I believe you want 6 4 4 4 2 1, which is length(a) + 1 - r, as well as rank(-a).


--
Brian D. Ripley,                  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to