[Rd] namespace S3 and S4 generic imports cannot both be satisfied:

From: Martin Morgan <mtmorgan_at_fhcrc.org>
Date: Sat, 08 Dec 2012 15:05:37 -0800


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

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

______________________________________________ R-devel_at_r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Received on Sat 08 Dec 2012 - 23:13:35 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 09 Dec 2012 - 21:22:49 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive