[Rd] S4 Method dispatch in recent 2.4.0alpha

Oosting, J. (PATH) J.Oosting at lumc.nl
Mon Sep 11 14:23:33 CEST 2006


I use 2 packages that both implement a S4 plot method, where one package
depends on the other (the bioconductor package globaltest which depends
on multtest). When the plot method is used from within the package, it
seems the default plot method is used, and an error is generated. When
the method is invoked from the console, the plot is created correctly. I
have reproduced this with 2 small packages (minipkg and minipkg2)
implementing just this part.
I've seen a thread about a similar problem, but that seemed mostly due
to already installed packages not handling the new S4 stuff.

mpplot() is a function that creates a class instance and (usually)
invokes the plot immediately. When the dependency on minipkg2 is removed
from the DESCRIPTION file the first call to mpplot() gives no error and
shows the plot.


Jan Oosting

> library(minipkg)
Loading required package: minipkg2
Creating a new generic function for 'plot' in 'minipkg2'
> mpplot(1:10)
Error in as.vector(x, "double") : cannot coerce to vector
> plot(mpplot(1:10,plot=FALSE)) # this shows a proper plot
> showMethods("plot")
Function: plot, (package graphics)
x="ANY"
x="mp.plot"
x="mp2.plot"
> sessionInfo()
R version 2.4.0 Under development (unstable) (2006-09-04 r39086) 
i386-pc-mingw32 

locale:
LC_COLLATE=Dutch_Netherlands.1252;LC_CTYPE=Dutch_Netherlands.1252;LC_MON
ETARY=Dutch_Netherlands.1252;LC_NUMERIC=C;LC_TIME=Dutch_Netherlands.1252

attached base packages:
[1] "methods"   "stats"     "graphics"  "grDevices" "utils"
"datasets" 
[7] "base"     

other attached packages:
 minipkg minipkg2 
 "1.0.0"  "1.0.0" 
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: minipkg_1.0.0.tar.gz
Type: application/x-gzip
Size: 694 bytes
Desc: minipkg_1.0.0.tar.gz
Url : https://stat.ethz.ch/pipermail/r-devel/attachments/20060911/539e3c96/attachment-0008.gz 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: minipkg2_1.0.0.tar.gz
Type: application/x-gzip
Size: 536 bytes
Desc: minipkg2_1.0.0.tar.gz
Url : https://stat.ethz.ch/pipermail/r-devel/attachments/20060911/539e3c96/attachment-0009.gz 


More information about the R-devel mailing list