How do I show the source code of an S4 function in a package? How do I show the source code of an S4 function in a package? r r

How do I show the source code of an S4 function in a package?


Use getMethod() and specify the signature. In your case, that could be eg :

getMethod("GenTable","topGOdata")

to show the GenTable method for topGOdata objects. In this case, there is only a method defined for topGOdata objects. In case there are methods with different signatures, showMethods() will tell you which ones. In your case :

showMethods("GenTable")# Function: GenTable (package topGO)# object="topGOdata"

You can get the code for the signature you want by specifying it in the getMethod() function.


I know this is an old question, but for the sake of completeness for future searchers, there's also a function called

selectMethod

that varies from getMethod in that you can use inheritance. This is how I found source for a generic function that has multiple signatures.