[Rd] as.data.frame() : needs "..." ?!

Martin Maechler maechler at stat.math.ethz.ch
Mon Nov 28 11:49:40 CET 2005


       [diverted from R-help to R-devel]

>>>>> "Gabor" == Gabor Grothendieck <ggrothendieck at gmail.com>
>>>>>     on Sun, 27 Nov 2005 14:16:34 -0500 writes:

	  <................>

    Gabor> making use of as.data.frame.table we can shorten that
    Gabor> slightly to just:

    Gabor> as.data.frame.table(table(Species = iris$Species),
    Gabor>                     responseName = "Count")

    Gabor> Incidently, I just noticed that there is an
    Gabor> inconsistency between as.data.frame and
    Gabor> as.data.frame.table making it impossible to shorten
    Gabor> as.data.frame.table to as.data.frame in the above due
    Gabor> to the responseName= argument which is not referenced
    Gabor> in the generic.

    >> args(as.data.frame)
    Gabor> function (x, row.names = NULL, optional = FALSE)
    Gabor> NULL
    >> args(as.data.frame.table)
    Gabor> function (x, row.names = NULL, optional = FALSE, Gabor> responseName = "Freq")
    Gabor> NULL

  {If you used  str() instead of args()  ,  you wouldn't get the
   superfluous extra 'NULL' line }

I think this is an example where we (R-core) haven't followed
our own recommendations, namely, that  generic functions (and
methods) need to have a (trailing) "..." argument
just so that new methods can have further arguments.

I'm wondering a bit... 
or could there be a good reason in the present case,
why this hasn't been done?

Martin



More information about the R-devel mailing list