[R] S4 vs S3. New Package
szehnder at uni-bonn.de
Sat Nov 9 17:30:45 CET 2013
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:
And for a bunch of packages look into the Bioconductor packages.
On 09 Nov 2013, at 16:22, daniel schnaider <dschnaider at gmail.com> wrote:
> 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.
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help