[Rd] S3 methods in packages. Change in R 4.0.0?

Herbert Braselmann br@@e|m @end|ng |rom he|mho|tz-muenchen@de
Fri Nov 15 14:42:52 CET 2019


Hello,

since Bioconductor devel branch 3.11 started, which is operating with 
R-devel 4.0.0 (for e.g. 2019-11-03 r77362 on OS X 10.11.6 El Capitan), 
my package CFAssay 1.21.0 is not built on none of all three Systems, 
Linux, Windos and Mac. The error message refers to xy.coords which is 
called by R function plot.default. I found out that it has to do with 
the S3 object system. In my package I defined an S3 method for R generic 
plot and three for print. To be free from the biological stuff I 
generated here a simple example package:

https://github.com/ZytoHMGU/myfirstS3steps

A simple method  'print.my1stClass' is defined there, which writes the 
sumproduct of two numerical entries or numbers of a list, given a class 
attribut matching the name of the method. Up to R 3.6.1 it works as one 
is used to expect from S3 methods. After attaching the package in R 
4.0.0, a call of 'print' for a list object of that class falls back to 
'print.default' and writes the list entries. However, when the method is 
sourced, so that it appears in the global environment, it works as 
expected for S3 with a 'print'. Independently thereof, the method is 
shown in the list with .S3methods(print) or .S3methods(call="my1stClass").

A similar problem has function plot, I don't show it here. It leads to 
an error message, when plot.default and xy.coords cannot work with the 
object for which the method was written. I guess that methods for 
'summary' and all other R base generics, written in a package as I did 
it and attached with the library command would have the same problem in 
R-devel 4.0. I did not try it. My questions are now:

(1) Is action required or is it a bug in 4.0?
(2) Should I be more stringent, for e.g. using special directives in the 
NAMESPACE file of the package? I did not.
(3) Should I change to S4? For e.g. Bioconductor package CGHbase (Mark 
van de Wiel) contains S4 plot-methods for its objects.

For whom it may be interesting the URL of my Bioconductor package:
http://bioconductor.org/checkResults/devel/bioc-LATEST/CFAssay/

Herbert Braselmann
<http://bioconductor.org/checkResults/devel/bioc-LATEST/aCGH/>

-- 

Abteilung Strahlenzytogenetik / Research Unit Radiation Cytogenetics
AG Integrative Biologie / Working group Integrative Biology
Tel./Phone: +49 89 3187-2878


 


Helmholtz Zentrum Muenchen

Deutsches Forschungszentrum fuer Gesundheit und Umwelt (GmbH)

Ingolstaedter Landstr. 1

85764 Neuherberg

www.helmholtz-muenchen.de

Aufsichtsratsvorsitzende: MinDir'in Prof. Dr. Veronika von Messling

Geschaeftsfuehrung: Prof. Dr. med. Dr. h.c. Matthias Tschoep, Kerstin Guenther

Registergericht: Amtsgericht Muenchen HRB 6466

USt-IdNr: DE 129521671


	[[alternative HTML version deleted]]



More information about the R-devel mailing list