[Bioc-devel] Importing generic functions from other pkgs and defining methods on them?

Benilton Carvalho bcarvalh at jhsph.edu
Fri Mar 9 03:01:40 CET 2007

Since we're on this topic... that reminds me a problem I've been  
trying to solve in the last days.

I have an "image" method (S4), which doesn't work when I build/ 
install the package... But it does work if I source the file that  
defines the method (after loading the just-built package).

Any chance this would be somewhat similar/related to what Wolfgang  


On Mar 8, 2007, at 6:57 PM, Seth Falcon wrote:

> Hi Wolfgang,
> Wolfgang Huber <huber at ebi.ac.uk> writes:
>> Hi,
>> I post this problem to the list b/c perhaps others have it as well  
>> and
>> so we only need to solve it once. Something with S4 and Namespaces
>> appears to have changed. With the current R-devel, I get from "R CMD
>> check tilingArray":
>>     .... SNIP ...
>> * checking package vignettes in 'inst/doc' ... WARNING
>> *** Weave Errors ***
>> File
>> /net/nfs7/vol6/research-huber/users/huber/madman/Rpacks/ 
>> tilingArray.Rcheck/tilingArray/doc/findsegments.Rnw
>> :
>> Error :  chunk 8 (label=penLLsim)
>> Error in logLik(seg) : no applicable method for "logLik"
>> When I run Sweave on the vignette interactively, there is no error!
>> Also, the package used to pass R CMD check a while ago, and has not
>> changed - but of course R has changed. In my NAMESPACE I have:
>>   importFrom("stats", "confint", "logLik", "residuals")
>> and in tilingArray/R/methods-segmentation.R
>> setMethod("logLik", "segmentation",
>>   function(object, penalty="none", ...) {
>>     ## BLA
>>   })
>> Does anybody have a pointer for where to look at?
> I had a quick look and it is strange.
> logLik is an S3 generic defined in stats.  You import it and define an
> S4 generic with the same name using the S3 generic as default.
> At the command line, you get the S4 generic.  Within your package
> code -- e.g. if you debug inside tilingArray:::plotPenLL -- then you
> get the one that was imported, that is, the S3 generic.  This causes
> the error.
> I thought at first it was the lack of a Collate field and that the
> plotPenLL was being defined before the generic, but that isn't the
> issue.
> I have to run right now, but you might want to try calling
> tilingArray::logLik inside plotPenLL and see if that helps.  That
> would be a temporary fix.
> A bit more investigation is needed.  This could be a bug in
> R/methods/namespace.
> Best,
> + seth
> -- 
> Seth Falcon | Computational Biology | Fred Hutchinson Cancer  
> Research Center
> http://bioconductor.org
> _______________________________________________
> Bioc-devel at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel

More information about the Bioc-devel mailing list