[R] rank in decreasing order
j.logsdon at quantex-research.com
Mon Aug 6 15:42:01 CEST 2007
total_list$field1.rank <- rank(-total_list$field1,ties.method="min")
Marvellous what a negative sign can achieve!
You may want to put ties.method="max" though depending on what you want...:)
On Monday 06 August 2007 14:13:35 Jiong Zhang, PhD wrote:
> Hi All,
> I want to give ranks to elements in a column so I used:
> total_list$field1.rank <- rank(total_list$field1,ties.method="min")
> But this gives me the rank in increasing order. How do I get the ranks in
> decreasing order? I know decreasing = FALSE is not a legal argument here.
> The email message (and any attachments) is for the sole use of the
> intended recipient(s) and may contain confidential information. Any
> unauthorized review, use, disclosure or distribution is prohibited. If you
> are not the intended recipient, please contact the sender by reply email
> and destroy all copies of the original message (and any attachments).
> Thank You.
> [[alternative HTML version deleted]]
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html and provide commented, minimal,
> self-contained, reproducible code.
John Logsdon "Try to make things as simple
Quantex Research Ltd, Manchester UK as possible but not simpler"
j.logsdon at quantex-research.com a.einstein at relativity.org
+44(0)161 445 4951/G:+44(0)7717758675 www.quantex-research.com
More information about the R-help