[Rd] package incompatibility under 2.5.0 (please respond directly, I am not on r-devel)

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Apr 13 08:38:59 CEST 2007


Unfortunately a claim of 'extensive regression testing' is not going to 
help you if the original contains the mistake.  It seems that your package 
is not using these functions as they are (and always have been, AFAIK) 
documented in R or the Blue and White Books.

A summary would be that new checks in R 2.5.0 have found several 
long-standing incompatibilities of your code with R.

R 2.5.0 is in feature freeze, and changing the argument list of basic 
functions is not something we would do lightly (and certainly not at this 
late stage).  In essence you are asking everyone else to change their 
usage to conform to yours, since if we change these many other packages 
(and R itself) will show warnings in 'R CMD check'.

There is an advantage in not having a '...' argument in generics that 
Martin Maechler often points out: it means that errors in actual argument 
names are caught.  And these new checks have caught unintended usage 
errors in other packages.

On Wed, 11 Apr 2007, Jens Oehlschlägel wrote:

> Dear all,
>
> For my package "ref" I have implemented extensive regression testing. It 
> now fails to compile since primitives "dim" and "dimnames" (and their 
> assignment methods) no longer allow for additional arguments. I was 
> using an additional argument "ref" with several methods. For "].refdata"

If you mean '[.refdata', '[' is really part of the language and documented 
to allow zero or more arguments.

> it still works, with "dim.refdata" no longer. Could you please allow for 
> additional arguments for the following generic functions (or 
> primitives):
>
> dim <- function (x, ...)
> UseMethod("dim")
>
> "dim<-" <- function (x, ..., value)
> UseMethod("dim<-")
>
> dimnames <- function (x, ...)
> UseMethod("dimnames")
>
> "dimnames<-" <- function (x, ..., value)
> UseMethod("dimnames<-")
>
> row.names <- function (x, ...)
> UseMethod("row.names")
>
> "row.names<-" <- function (x, ..., value)
> UseMethod("row.names<-")
>
> names <- function (x, ...)
> UseMethod("names")
>
> "names<-" <- function (x, ..., value)
> UseMethod("names<-")
>
> BTW: why does get("dim") returns
> function (x) .Primitive("dim")
> and args() works on it,
> while get("[") returns
> .Primitive("[")
> and args() doesn't work on it?

It is regarded as part of the language (like '{' and '(', which equally 
are primitives).  It would be unusual to apply them as functions, and 
args() applies to functions.

> Furthermore, until now "rownames", "colnames" have been convenience 
> wrappers for "dimnames". Consequently implementing "dimnames" and 
> "dimnames<-" would indirectly implement "rownames", "colnames" and their 
> assignment methods. This no longer works for classes inheriting from 
> "data.frame" because the assignment methods no longer work via 
> "dimnames<-". I can imagine that this change breaks existing code in 
> other packages as well - without formally throwing errors at package 
> check time (as I said, I have unusually strict regression testing 
> included in the example section, that other packages may not have).
> If it is really necessary to treat data.frames differently, I'd

It is.

> recommend to change "rownames" and "colnames" accordingly, in order to 
> have symmetry between accessor and assignment functions. That would mean 
> defining "names" and "row.names" and their assignment methods for any 
> classes inheriting from data.frame, instead of "dimnames", correct? 
> Maybe *all* package maintainers should be warned about this or R CMD 
> CHECK should check whether anyone defines "dimnames" or "dimnames<-" for 
> any class inheriting from "data.frame".

The documentation says (and used to say)

      For a data frame, 'rownames' and
      'colnames' are equivalent to 'row.names' and 'names' respectively,
      but the latter are preferred (and can be much faster).

and it now works as documented.

>
> Best regards
>
>
> Jens Oehlschlägel
>
>
>
>> -----Ursprüngliche Nachricht-----
>> Von: Uwe.Ligges at R-Project.org
>> Gesendet: 08.04.07 16:50:29
>> An: joehl at web.de
>> CC: Uwe.Ligges at R-Project.org,olafm at kimberly.tako.de
>> Betreff: Package ref_0.92.tar.gz did not pass R CMD check
>
>
>> Dear package maintainer,
>>
>> this notification has been generated automatically.
>> Your package ref_0.92.tar.gz did not pass 'R CMD check' on
>> Windows and will be omitted from the corresponding CRAN directory
>> (CRAN/bin/windows/contrib/2.5/).
>> Please check the attached log-file and consider to resubmit a version
>> with increased version number that passes R CMD check on Windows.
>> R version 2.5.0 alpha (2007-04-05 r41063)

[...]

>> Error in identical(dim(rx3, ref = TRUE), dim(x)) :
>> 2 arguments passed to 'dim' which requires 1
>> Execution halted

-- 
Brian D. Ripley,                  ripley at 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


More information about the R-devel mailing list