[Rd] Possible problem with S4 dispatch
sfalcon at fhcrc.org
Tue May 1 06:48:56 CEST 2007
First a bit of disclaimer... I haven't isolated this problem into an
easy to reproduce case, and I won't be surprised if the root cause is
a fault in my code's use of name spaces or some such.
The error I'm seeing is one in which the desired method is not found.
What worries me in terms of my expectations of how to debug the
problem is that showMethods and selectMethod both find the method.
Here is an example browser session:
## Input 1, a character vector
 "1005_at" "1007_s_at" "1008_f_at"
## Input 2, an object of class AtomicAnnMap (subclass of AnnMap)
## See what selectMethod has to say (it finds the method I'm expecting)
Browse> selectMethod("mget", signature(x="character", envir=class(LLe)))
function (x, envir, mode = "any", ifnotfound = list(function(x) stop(paste("value for '",
x, "' not found", sep = ""), call. = FALSE)), inherits = FALSE)
as.list(envir, names = x)
target "character" "AtomicAnnMap"
defined "ANY" "AnnMap"
## Call it (we get base::mget, not the generic and hence an error)
Browse> mget(gN[1:3], LLe)
Error in mget(x, envir, mode, ifnotfound, inherits) :
second argument must be an environment
 "package:AnnotationDbi" "package:base"
The package code I'm working with imports the package that defines the
mget method (and this package does exportMethods(mget)), yet the
problem seems to be that the mget generic is not found -- but I find
it confusing that selectMethod works here.
Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center
More information about the R-devel