Skip to content
Prev 4171 / 21307 Next

[Bioc-devel] Recent issue with plot method dispatch

On 03/14/2013 07:16 AM, Joern Toedling wrote:
Hi Joern --

I did follow up with this on R-devel

   https://stat.ethz.ch/pipermail/r-devel/2013-March/066111.html

A change in 'intervals' triggered this problem (exporting an S4 method and hence 
generic for plot), not a change in R.

The problem was that setMethod finds the S4 generic 'plot' on the search path, 
rather than the S3 plot imported in your  name space (I personally think this is 
not correct behaviour); your namespace then exports the unmodified S3 generic, 
masking the S4 generic on the search path that your method was added to.

A better work-around is to importFrom(intervals, plot); this avoids creating 
another S4 generic 'plot'. Experience has shown that having multiple generics of 
the same function creates problems as additional packages enter the picture; 
this is what motivates the BiocGenerics package.

An additional enhancement, not under your control, would be for intervals to 
reuse the S4 plot generic from stats4 -- importFrom (stats4, plot) -- and for 
your package too to importFrom(stats4, plot); the packages would then be adding 
methods to the same generic, and could do so independently of what packages 
(other than stats4) were doing.

Martin