The value of 2 gets a 1.0 rank. That makes sense to me.
The two values of 1 get a 2.5 rank. That makes sense, too, as the fractional part of the return value signals a tie.
The five values of 0 get a 6.0 rank. This confuses me. Both because rank()'s default ties.method is "average" and 6 isn't that, but mostly I'm confused that I get no indication of a tie, despite the five zeros in the vector.
Perhaps I'm going about this all wrong. My ideal output is achieved by rank(x, ties.method = "min") but I also need to know whether ties exist.
Thanks for helping me understand that. Much appreciated.
I chose a new, cleaner tack to solve this, writing a short function to return a vector of logicals indicating whether the values are duplicated and thus indicative of a tie. Essentially, just vec %in% unique(vec[duplicated(vec)]).
I then just used rank() with its ties.method = "min" to provide the rank order I required.