Full_Name: Doug Grove Version: R.1.9.1 OS: Linux Submission from: (NULL) (140.107.156.61) I just found that rank() has a 'decreasing' argument that is not documented in its help page. I checked my version of 2.0.0 (original release hence unpatched) and it is not documented there. For curiousity I also went back to version 1.8.1 and checked the function (not the documentation)and at that point rank() had not yet acquired the 'decreasing' argument. It's ironic as I was wishing that rank() had a decreasing option like sort does, and then I found that it already does. Thanks, Doug
dgrove@fhcrc.org writes:> I just found that rank() has a 'decreasing' argument that is not documented in > its > help page. I checked my version of 2.0.0 (original release hence unpatched) > and > it is not documented there. For curiousity I also went back to version 1.8.1 > and > checked the function (not the documentation)and at that point rank() had not > yet > acquired the 'decreasing' argument. > > It's ironic as I was wishing that rank() had a decreasing option like > sort does, and then I found that it already does.Eh???? I have> rankfunction (x, na.last = TRUE, ties.method = c("average", "first", "random", "max", "min")) {.... And we do have QC tools that work very hard to ensure that all arguments are documented! -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907
On Wed, 20 Oct 2004, Douglas Grove wrote:> Oh crap. So sorry. This is my fault (obviously). > Prior to the new ties methods being added in 2.0.0 > I modified the source to do this myself. So looks > like I forgot: (1) that my modified code was still > being accessed default (thought I'd removed it) and > (2) that I had added in the 'decreasing' argument. > > It did seem very odd to me when I saw the undocumented > argument. > > Sorry for the this faulty bug report. > > BTW, would someone please add a 'decreasing' argument to rank. > It seems natural to have one, just like sort, and only > involves about two lines of code and a few lines of > editing to the help file.I don't think so. At the very least, each tie method needs a change, as may the handling of NAs. Also the writing a comprehensible help page will become very complex. What is the need? Rank works for numeric vectors, and why can't you just call rank(-x) or n+1-rank(x)? The reason that does not work for sort() is that it deals with non-numeric vectors. Incidentally, we might need a `last' value for ties.method. -- Brian D. Ripley, ripley@stats.ox.ac.uk 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
On Thu, 21 Oct 2004, Prof Brian Ripley wrote:> On Wed, 20 Oct 2004, Douglas Grove wrote: > > > Oh crap. So sorry. This is my fault (obviously). > > Prior to the new ties methods being added in 2.0.0 > > I modified the source to do this myself. So looks > > like I forgot: (1) that my modified code was still > > being accessed default (thought I'd removed it) and > > (2) that I had added in the 'decreasing' argument. > > > > It did seem very odd to me when I saw the undocumented > > argument. > > > > Sorry for the this faulty bug report. > > > > BTW, would someone please add a 'decreasing' argument to rank. > > It seems natural to have one, just like sort, and only > > involves about two lines of code and a few lines of > > editing to the help file. > > I don't think so. At the very least, each tie method needs a change, as > may the handling of NAs. Also the writing a comprehensible help page will > become very complex. > > What is the need? Rank works for numeric vectors, and why can't you just > call rank(-x) or n+1-rank(x)? The reason that does not work for sort() is > that it deals with non-numeric vectors.As you note there isn't a need, I just am used to thinking about ranking and sorting as being either increasing (the default) or decreasing, having an explicit 'decreasing' option makes the the code more transparent. It's a minor thing but as I erroneously supposed it to be easy, it seemed worthwhile. You're right that there would need to be a special case for at least ties.method='first', but I think for the others just using if (decreasing) x <- -x should be all that is needed.> Incidentally, we might need a `last' value for ties.method.I don't see that my suggestion necessitates that. However one could argue for a 'last' value in ties.method for completeness. I personally have had no need for 'first' nor would I for 'last'.> -- > Brian D. Ripley, ripley@stats.ox.ac.uk > 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 >