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

Attachment: PkgAB.tar.gz
Description: GNU Zip compressed data

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

Reply via email to