[Rd] S4 method implementation for S3 class

Joris Meys jorismeys at gmail.com
Sun Sep 24 13:51:24 CEST 2017


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]]



More information about the R-devel mailing list