I am using rank(a, ties.method="max")
to rank a. But I am not quite sure what does ties.method="max"
do. Can you please help?
Asked
Active
Viewed 3.3k times
1 Answers
27
Ties.method specifies the method rank uses to break ties. Suppose you have a vector c(1,2,3,3,4,5). It's obvious that 1 is first, and 2 is second. However, it's not clear what ranks should be assigned to the first and second 3s. Ties.method determines how this is done. There are a few options:
- average assigns each tied element the "average" rank. The ranks would therefore be 1, 2, 3.5, 3.5, 5, 6
first lets the "earlier" entry "win", so the ranks are in numerical order (1,2,3,4,5,6)
min assigns every tied element to the lowest rank, so you get 1,2,3,3,5,6
max does the opposite: tied elements get the highest rank (1,2,4,4,5,6)
random breaks ties randomly, so you'd get either (1,2,3,4,5,6) or (1,2,4,3,5,6).

Matt Krause
- 19,089
- 3
- 60
- 101
-
Thank you very much! Your answer helped me solve my problem! Thank you again! – Joy Aug 09 '12 at 18:24
-
2No problem. You may already know this, but `?command` will print the help for a command. – Matt Krause Aug 12 '12 at 03:52