[Rd] Possible bug in base::namespaceImportFrom?

Seth Falcon sfalcon at fhcrc.org
Fri Sep 22 06:52:00 CEST 2006


namespaceImportFrom in base/R/namespace.R has the following:

       fdef <- methods:::getGeneric(genName, impenv)

The definition of getGeneric is in methods/R/RMethodUtils.R starts

    getGeneric <-
      ## return the definition of the function named f as a generic.
      ## If there is no definition, throws an error or returns
      ## NULL according to the value of mustFind.
      function(f, mustFind = FALSE, where = .genEnv(f, topenv(parent.frame()), package),
               package = "")

I think the call to getGeneric in namespaceImportFrom should use named
arguments because impenv, an environment, will be assigned to the
mustFind arg which is most likely not desired.

An example where this seems to show up is in the check reports for


Here's the snip from the check output (the results may have been
updated in the meantime):

    * checking whether the name space can be loaded with stated dependencies ... WARNING
    Loading required package: methods
    Error in if (mustFind) stop(gettextf("no generic function found for \"%s\"",  : 
    	argument is not interpretable as logical
    In addition: Warning message:
    the condition has length > 1 and only the first element will be used in: if (mustFind) stop(gettextf("no generic function found for \"%s\"",  
    Execution halted

I'm having trouble reproducing it on my local system, but thought I
would bring it to the team's attention.


+ seth

More information about the R-devel mailing list