rank((-x$a))

rank() does not work on lists but on numeric vectors, and the above works 
generally for numeric vectors.

On Tue, 20 Apr 2004, Manoj - Hachibushu Capital wrote:

> Dear All,
>       Is there any simple way to way to produce "rank", for a given
> list, but in a descending order?
> 
>       E.G:    
>               x       = list(a=c(1,5,2,4));
>               rank(x$a);      produces 1,4,2,3 
> 
>       However I am looking for a way to generate (4,1,3,2). 
> 
>       It would be particularly nice if the proposed solution has all
> the niceties of rank function (like NA handling and ties.method
> functionality) 

-- 
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://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to