[Rd] namespace S3 and S4 generic imports cannot both be satisfied:
Martin Morgan
mtmorgan at fhcrc.org
Sun Dec 9 00:05:37 CET 2012
PkgA wishes to write a method for 'unique' on S4 class 'A'. ?Methods indicates
that one should
setGeneric("unique")
setClass("A")
unique.A <- function(x, incomparables=FALSE, ...) {}
setMethod(unique, "A", unique.A)
Both S3 and S4 methods need to be exported in the NAMESPACE
import(methods)
S3method(unique, A)
exportMethods(unique)
PkgB introduces a new class and method
setClass("B")
unique.B <- function(x, incomparables=FALSE, ...) {}
setMethod(unique, "B", unique.B)
and in the NAMESPACE has
import(methods)
importFrom(PkgA, unique)
S3method(unique, B)
exportMethods(unique)
Unfortuantely, R CMD check says that
* checking whether package 'PkgB' can be installed ... WARNING
Found the following significant warnings:
Warning: found an S4 version of 'unique' so it has not been imported correctly
See '/home/mtmorgan/tmp/PkgB.Rcheck/00install.out' for details.
This is from (svn r61253) R-devel/src/library/base/R/namespace.R:1339, where the
code finds the S4 generic, but not the S3 generic. Obviously the namespace
cannot have both the S3 and S4 symbols defined, but this seems to be required? A
workaround might extend the check to include getGeneric(genname)@default.
This scenario is reproducible in the attached tarball
tar xzf PkgAB.tar.gz
R CMD INSTALL PkgA
R CMD check PkgB
Martin Morgan
--
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109
Location: Arnold Building M1 B861
Phone: (206) 667-2793
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PkgAB.tar.gz
Type: application/x-gzip
Size: 973 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20121208/df47c96a/attachment.gz>
More information about the R-devel
mailing list