[Bioc-devel] Importing generic functions from other pkgs and defining methods on them?
sfalcon at fhcrc.org
Fri Mar 9 03:27:56 CET 2007
I think I have a solution for you. You need to remove the conditional
definition of the generics.
I know that at some point in the past one needed to do things like
But this is no longer required and it seems to cause problems if it is
there. I simply removed the if's in your AllGenerics.R and then the
package built and checked for me.
I don't completely understand what was going on, but some parts of
your code were not getting the generic when it was needed.
The if (!isGeneric) idiom is rather odd if you think about it. The
only sensible way to define a method on a generic is if you know a
fair bit about that generic (e.g., what its formal arguments are).
When you optionally don't define your own generic and then set a
method, who knows what the generic will be....
So. Remove the if(!isGeneric) and things should improve.
Also, since I spent some time looking at the code:
* You should add a .onLoad function that does require("methods") as
per Writing R Extensions and use of S4 + NAMESPACE
* If you call plotPenLL in the vignette, perhaps you should export it
instead of using ':::'.
* You should add a Collate field to the DESCRIPTION file. You are
getting a reasonable order at present, but since you have a lot of
R files, that luck is going to run out sooner or later.
* It is probably also worth adding import(method) to the NAMESPACE
file. The rule, it seems, with the methods package, is that if
there is a place where you could possible ask to use it, then you
should (DESCRIPTION, .onLoad, NAMESPACE).
Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center
More information about the Bioc-devel