sebastian.meyer at ifspm.uzh.ch
2012-Aug-28 21:11 UTC
[Rd] using setOldClass() causes warning on unloadNamespace() if the package imports methods
For the CRAN-package "surveillance",
unloadNamespace("surveillance") gives the following warning message:
In FUN(X[[2L]], ...) :
Created a package name, ?2012-08-28 22:42:37?, when none found
Similar warnings appear for the CRAN-package "solaR" and probably some
other packages.
I created a dummy package (tarball is attached) to find out where this warning
comes from.
Apparently, the warning is related to the package defining a virtual S4 class
using setOldClass("fooS3class"). However, the crucial thing is that
the warning only appears, when the methods package is imported in the NAMESPACE.
There is also no warning if setClass("fooS3class") is used instead. So
my question is: What would be the right way of handling S3 classes in the S4
world?
My minor second question is: Should the NAMESPACE state exportMethods(coerce) if
the package defines new coerce-methods? It seems that coercion-methods defined
by the package using setAs() are also visible after loading the package without
explicitly exporting these. However, if one includes exportMethods(coerce) then
one must also document them (as stated by R CMD check).
Thanks for any hints!
Sebastian
PS: using
R Under development (unstable) (2012-08-28 r60472)
Platform: x86_64-unknown-linux-gnu (64-bit)