[Rd] Documentation of ties.method argument in `rank`

Stavros Macrakis macrakis at alum.mit.edu
Thu Aug 20 23:51:01 CEST 2009


In R 2.9.1/Windows, ? rank says:

Usage:
     rank(x, na.last = TRUE,
          ties.method = c("average", "first", "random", "max", "min"))
Arguments:
       ...
     ties.method: a character string specifying how ties are treated,
see 'Details'; can be abbreviated.

This appears contradictory -- the default value is a vector of
strings, while the argument specification requires a single string.
Looking at the code for `rank` shows what is going on -- by using
`match.arg`, `rank` is treating this default value as the list of
legal argument values, not as the default value.  The default is in
fact the first value, "average".

I suspect that this convention is documented somewhere (where?), but I
think it would be useful to make it explicit in the documentation for
`rank`.

            -s



More information about the R-devel mailing list