[Rd] depends/suggests when making a new generic to override a function in a user package

Dr Gregory Jefferis jefferis at mrc-lmb.cam.ac.uk
Fri Jul 6 12:57:44 CEST 2012

Dear R developers,

I would like to add a new S3 generic to override a function in a user package, specifically:


I have followed the recommendation here:


doing this:


as.repeatedTrain.default<-function(x,...) {

but the question now arises, how do I make sure that my as.repeatedTrain generic function is used in preference to STAR's. If my package suggests STAR, then STAR will likely be loaded afterwards and my generic will get clobbered. So at the moment I have made my package depend on STAR rather than suggest it. However I will only occasionally use STAR, and it is quite a big package with a number of dependencies and I would prefer to avoid this. Is there another approach? I assume this isn't a problem for a non-generic in a base package because they are loaded first.

Many thanks for any suggestions,

Greg Jefferis.
Gregory Jefferis, PhD                      
Division of Neurobiology                   
MRC Laboratory of Molecular Biology,       
Hills Road,                                
Cambridge, CB2 0QH, UK.                    


More information about the R-devel mailing list