From jori@mey@ @ending from gm@il@com  Thu May 24 15:39:27 2018
From: jori@mey@ @ending from gm@il@com (Joris Meys)
Date: Thu, 24 May 2018 15:39:27 +0200
Subject: [Rd] Creating S3 methods for S4 classes (coming from
 r-package-devel)
Message-ID: <CAO1zAVZUQukdm1Dr-428wDZ-g-ySgsTByKv-XUZ8cJihi0+Oyw@mail.gmail.com>

 Dear all,

I asked this question on r-package-devel but Martin Maechler pointed out
this was more suited on R-devel. So here it goes:

per the manual, one should create and register both the S3 and a S4 method
if one needs a method for an S4 class for a function using S3 dispatching.
This is cumbersome, and not very optimal.

I was wondering if there's a better way to do this. Currently I recreate a
generic in my package and create a default method that sends all the other
classes to the S3 generic, eg:

setGeneric("predict")
setMethod("predict", "ANY", stats::predict)

I'm not sure if this hasn't any adverse consequences, as it is not the
recommended approach.

It would be great if these generics could be made available through stats4.
If this would be the prefered route, I volunteer to create the patch for
that.

Any thoughts?
Cheers
Joris

(Original mail on r-package-devel :
https://stat.ethz.ch/pipermail/r-package-devel/2018q2/002757.html )


-- 
Joris Meys
Statistical consultant

Department of Data Analysis and Mathematical Modelling
Ghent University
Coupure Links 653, B-9000 Gent (Belgium)
<https://maps.google.com/?q=Coupure+links+653,%C2%A0B-9000+Gent,%C2%A0Belgium&entry=gmail&source=g>

-----------
Biowiskundedagen 2017-2018
http://www.biowiskundedagen.ugent.be/

-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

	[[alternative HTML version deleted]]



[Rd] Creating S3 methods for S4 classes (coming from r-package-devel)
Joris Meys