[Rd] improved error message when existing implicit S4 generic is not imported?

Martin Morgan mtmorgan at fhcrc.org
Sun Feb 26 07:39:49 CET 2012


pkgA's NAMESPACE has

   importFrom(graphics, plot)
   exportClasses("A")
   exportMethods("plot")

R/foo.R has

   setClass("A")
   setMethod("plot", "A", function(x, y, ...) {})

During R CMD INSTALL pkgA_1.0.tar.gz we are told

** preparing package for lazy loading
Creating a generic function for 'plot' from package 'graphics' in 
package 'pkgA'
** help
No man pages found in package  ‘pkgA’
*** installing help indices
** building package indices
** testing if installed package can be loaded

* DONE (pkgA)

pkgB has in its DESCRIPTION

   Depends; pkgA

with NAMESPACE

   importFrom(graphics, plot)
   exportClasses("B")
   exportMethods("plot")

R/bar.R has

   setClass("B")
   setMethod("plot", "B", function(x, y, ...) {})

During R CMD INSTALL pkgB_1.0.tar.gz we are told

** preparing package for lazy loading
** help

i.e., no implicit generic created (because graphics::plot already has an 
implicit generic created, when the pkgA dependency was attached?). and also

** testing if installed package can be loaded
Error : Functions for exporting methods must have been made generic, 
explicitly or implicitly; not true when loading 'pkgB' for 'plot'
Error: loading failed
Execution halted
ERROR: loading failed

which doesn't seem accurate, rather "'pkgB' does not import S4 implicit 
generic for 'plot' created by 'pkgA'"

 > sessionInfo()
R Under development (unstable) (2012-02-25 r58492)
Platform: x86_64-unknown-linux-gnu (64-bit)

Martin
-- 
Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109

Location: M1-B861
Telephone: 206 667-2793



More information about the R-devel mailing list