[Rd] Strange warnings when unloading packages with S4 classes

Winston Chang winstonchang1 at gmail.com
Thu Dec 19 19:24:54 CET 2013


(Sorry, this was previously sent with HTML mail. Resending in plain text.)

I've been seeing warnings when unloading packages. They can be seen
with the shiny and sp packages, among others (this is on R 3.0.2). For
example:
> library(sp)
> unloadNamespace('sp')
Warning messages:
1: In FUN(X[[2L]], ...) :
  Created a package name, ‘2013-12-19 12:14:24’, when none found
2: In FUN(X[[2L]], ...) :
  Created a package name, ‘2013-12-19 12:14:24’, when none found
3: In FUN(X[[2L]], ...) :
  Created a package name, ‘2013-12-19 12:14:24’, when none found
4: In FUN(X[[2L]], ...) :
  Created a package name, ‘2013-12-19 12:14:24’, when none found

It appears to be related to the methods:::.removeSuperclassBackRefs function.


I can get the warnings to appear when the following are both true:
* The package has an S4 class which inherits from a class outside of
the package.
* The NAMESPACE file contains import(methods)

I've created some very simple test packages here which illustrate the
problem, along with instructions on how to duplicate the warning.
https://github.com/wch/s4unload

The warnings only appear when unloading the package where both of the
conditions above are true. I'm not sure why import(methods) should
make a difference, but it does.

Is this a bug in the implementation of S4?

Best,
-Winston



More information about the R-devel mailing list