S4 vs S3. New Package

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

S4 vs S3. New Package

daniel schnaider
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.

2) Documentation. It has been really hard to find examples in S4. Most
books and articles consider straightforward S3 examples.

Thanks,

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: S4 vs S3. New Package

szehnder@uni-bonn.de
This depends very often of on the developer and what he is comfortable with. I like S4 classes, as I come from C++ and S4 classes approximate C++ classes at least more than S3 classes do (Reference Classes would do so even more and I know very good R programmers liking these most).

1) I wrote a package for MCMC simulation with S4 classes carrying all simulated values - fast enough for me: in less than 1.5 secs I have my sample of 100.000 values together with several other 100T values like log-likelihoods, posterior hyper parameters, etc. I watch out for not copying too often an object but sometimes it is not avoidable.

2) That is not true:
   
Books:
http://www.amazon.de/Software-Data-Analysis-Programming-Statistics/dp/0387759352/ref=sr_1_1?ie=UTF8&qid=1384014486&sr=8-1&keywords=John+chambers+data
http://www.amazon.de/Programming-Data-Language-John-Chambers/dp/0387985034/ref=sr_1_4?ie=UTF8&qid=1384014486&sr=8-4&keywords=John+chambers+data

Online:
https://www.rmetrics.org/files/Meielisalp2009/Presentations/Chalabi1.pdf
https://www.stat.auckland.ac.nz/S-Workshop/Gentleman/S4Objects.pdf

And for a bunch of packages look into the Bioconductor packages.

Best

Simon

On 09 Nov 2013, at 16:22, daniel schnaider <[hidden email]> 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.
>
> 2) Documentation. It has been really hard to find examples in S4. Most
> books and articles consider straightforward S3 examples.
>
> Thanks,
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: S4 vs S3. New Package

Rolf Turner
In reply to this post by daniel schnaider


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.

     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.
>
> 2) Documentation. It has been really hard to find examples in S4. Most
> books and articles consider straightforward S3 examples.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: S4 vs S3. New Package

daniel schnaider
In reply to this post by szehnder@uni-bonn.de
Thank you!


On Sat, Nov 9, 2013 at 2:30 PM, Simon Zehnder <[hidden email]> wrote:

> This depends very often of on the developer and what he is comfortable
> with. I like S4 classes, as I come from C++ and S4 classes approximate C++
> classes at least more than S3 classes do (Reference Classes would do so
> even more and I know very good R programmers liking these most).
>
> 1) I wrote a package for MCMC simulation with S4 classes carrying all
> simulated values - fast enough for me: in less than 1.5 secs I have my
> sample of 100.000 values together with several other 100T values like
> log-likelihoods, posterior hyper parameters, etc. I watch out for not
> copying too often an object but sometimes it is not avoidable.
>
> 2) That is not true:
>
> Books:
>
> http://www.amazon.de/Software-Data-Analysis-Programming-Statistics/dp/0387759352/ref=sr_1_1?ie=UTF8&qid=1384014486&sr=8-1&keywords=John+chambers+data
>
> http://www.amazon.de/Programming-Data-Language-John-Chambers/dp/0387985034/ref=sr_1_4?ie=UTF8&qid=1384014486&sr=8-4&keywords=John+chambers+data
>
> Online:
> https://www.rmetrics.org/files/Meielisalp2009/Presentations/Chalabi1.pdf
> https://www.stat.auckland.ac.nz/S-Workshop/Gentleman/S4Objects.pdf
>
> And for a bunch of packages look into the Bioconductor packages.
>
> Best
>
> Simon
>
> On 09 Nov 2013, at 16:22, daniel schnaider <[hidden email]> 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.
> >
> > 2) Documentation. It has been really hard to find examples in S4. Most
> > books and articles consider straightforward S3 examples.
> >
> > Thanks,
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] 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.
>
>

--
Daniel Schnaider

SP Phone:  +55-11-9.7575.0822


[hidden email]
skype dschnaider
Linked In: http://www.linkedin.com/in/danielschnaider

w <http://www.arkiagroup.com/>ww.scaigroup.com

Depoimentos de clientes <http://www.scaigroup.com/Projetos/depoimentos>

Casos de Sucesso & ReferĂȘncias <http://www.scaigroup.com/Projetos>

SCAI Group no Facebook <http://facebook.scaigroup.com/>

SCAI Group no Twitter <http://twitter.scaigroup.com/>

SCAI Group no Google Plus <http://plus.scaigroup.com/>

        [[alternative HTML version deleted]]


______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: S4 vs S3. New Package

Martin Morgan
In reply to this post by Rolf Turner
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.
>
> ______________________________________________
> [hidden email] 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

______________________________________________
[hidden email] 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.