[Rd] stats::median

Martin Maechler maechler at stat.math.ethz.ch
Mon Feb 27 10:42:19 CET 2017


>>>>> Rob J Hyndman <Rob.Hyndman at monash.edu>
>>>>>     on Wed, 15 Feb 2017 21:48:56 +1100 writes:

    > The generic stats::median method is defined as median <-
    > function (x, na.rm = FALSE) {UseMethod("median")}

    > I suggest that this should become median <- function (x,
    > na.rm = FALSE, ...)  {UseMethod("median")}

    > This would allow additional S3 methods to be developed
    > with additional arguments.

and  S4  methods, too.

    > Currently I have to over-ride this generic definition in
    > the demography package because median.demogdata has
    > several other arguments.

    > This shouldn't break any code, and will make it easier for
    > new S3 methods to be developed. It is also consistent with
    > almost all other S3 methods which do include an ellipsis.

"shouldn't break any code"   is almost always quite optimistic
	   nowadays,....

Actually it probably will break things when people start using
the new R version which implements the above *AND* use packages
installed with a previous version of R.
I agree that this does not count as "breaking any code".

In spite of all that  *and*
the perennial drawback that a '...' will allow argument name
typos to go unnoticed

I agree you have a good argument nowadays, that median() should
be the same as many similar "basic statistics" R functions and
so I'll commit such a change to R-devel (to become R 3.4.0 in April).

Thank you for the suggestion!
Martin Maechler,
ETH Zurich

    > -------------------------------------------------------------
    > Rob J Hyndman Professor of Statistics, Monash University
    > www.robjhyndman.com

    > ______________________________________________
    > R-devel at r-project.org mailing list
    > https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list