[R] S4 vs S3. New Package

Martin Morgan mtmorgan at fhcrc.org
Sat Nov 9 23:54:14 CET 2013


On 11/09/2013 11:59 AM, Rolf Turner wrote:
>
>
> For my take on the issue see fortune("strait jacket").
>
>      cheers,
>
>      Rolf Turner
>
> P. S.  I said that quite some time ago and I have seen nothing
> in the intervening years to change my views.

Mileage varies; the Bioconductor project attains a level of interoperability and 
re-use (http://www.nature.com/nbt/journal/v31/n10/full/nbt.2721.html) that would 
be difficult with a less formal class system.

>
>      R. T.
>
>
> On 11/10/13 04:22, daniel schnaider wrote:
>> Hi,
>>
>> I am working on a new credit portfolio optimization package. My question is
>> if it is more recommended to develop in S4 object oriented or S3.
>>
>> It would be more naturally to develop in object oriented paradigm, but
>> there is many concerns regarding S4.
>>
>> 1) Performance of S4 could be an issue as a setter function, actually
>> changes the whole object behind the scenes.

Depending on implementation, updating S3 objects could as easily trigger copies; 
this is a fact of life in R. Mitigate by modelling objects in a vector 
(column)-oriented approach rather than the row-oriented paradigm of Java / C++ / 
etc.

Martin Morgan

>> 2) Documentation. It has been really hard to find examples in S4. Most
>> books and articles consider straightforward S3 examples.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


-- 
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



More information about the R-help mailing list