From jorismeys at gmail.com  Sun Sep 24 13:51:24 2017
From: jorismeys at gmail.com (Joris Meys)
Date: Sun, 24 Sep 2017 13:51:24 +0200
Subject: [Rd] S4 method implementation for S3 class
In-Reply-To: <CALEXWq1seCSkhZ7Qpbz_vq24ph0fKO06xdnDWeOi72_ZcKvsJg@mail.gmail.com>
References: <CALEXWq2Pfutuh1Na5cUaopUyup7WYPddd2HYKBhYGdxesabm0A@mail.gmail.com>
 <CAOQ5NycG-TAu-QAj74Z_LZOurNTPB-yRyGuCpOTkBpGfytvFoQ@mail.gmail.com>
 <CALEXWq0z7UQaoHzfvNbfvQ8Q3vkc5Nvu1Zw4VKSMM9vQzJpphw@mail.gmail.com>
 <CAOQ5NyfS7dDLWm+W-k99YCndPd7C8C2WzU3Two3vSXFeeOBvfw@mail.gmail.com>
 <CALEXWq1seCSkhZ7Qpbz_vq24ph0fKO06xdnDWeOi72_ZcKvsJg@mail.gmail.com>
Message-ID: <CAO1zAVYukjG1m8i4EK815W4BAe-ykqUDQsuB13BovJt29ossmw@mail.gmail.com>

You can always check eg the Matrix package to show you how it's done.

Cheers
Joris

On Sat, Sep 23, 2017 at 6:17 PM, I?aki ?car <i.ucar86 at gmail.com> wrote:

> > There is formally no such thing as an S3 class. Just S3 objects with a
> > class attribute. You could extend a base class with an S4 class, like
> > setClass("IntegerWithUnits", slots=c(units="Units"),
> > contains="integer"). Sure, that's a disruptive change, but it would be
> > in the right direction.
> >
> > Extending base classes is always a risky proposition, as you've
> > discovered. Ideally you would override every transformation in order
> > to adjust or carry over the representation accordingly. The problem is
> > that there's a huge amount of transformations available for base
> > classes, mostly not encapsulated by generics.
> >
> > Other possibilities include:
> > - Convincing someone to make %*% an internal S3 generic
> > - Promoting %*% to an R-level S3 generic, which would only work with
> > code that sees your namespace
> >
> > Hopefully others have better ideas,
> > Michael
>
> Thanks for your kind help and suggestions, Michael. I think I'll take
> the last option as a workaround, at least until I evaluate the
> advantages and drawbacks of a complete redesign.
>
> I?aki
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



-- 
-----------

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

-----------

Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Mathematical Modelling, Statistics and Bio-Informatics

tel :  +32 (0)9 264 61 79
Joris.Meys at Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

	[[alternative HTML version deleted]]



[Rd] S4 method implementation for S3 class
Joris Meys