[R] To implement OO or not in R package, and if so, how to structure it?

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Thu Sep 14 18:02:11 CEST 2017


I think you should consider whether the advantages of making an object-aware collections class are worth the effort... lists are the standard tool for this task in R, and are normally handled using the functional programming paradigm. Just make sure a sufficiently-complete set of methods are available for the objects you plan to make lists of. 
-- 
Sent from my phone. Please excuse my brevity.

On September 14, 2017 7:27:55 AM PDT, Alexander Shenkin <ashenkin at ufl.edu> wrote:
>>>> Did you read this?
>>>> https://cran.r-project.org/doc/contrib/Leisch-CreatingPackages.pdf
>>>>
>>>> Maybe it could give you some insight in how to create package.
>>>
>>> That resource is ~9 years old. There are more modern treatments
>available. You
>>> can read mine at http://r-pkgs.had.co.nz.
>>>
>>> Hadley
>>>
>
>Thanks both.  I'm reading through your new book now Hadley... thanks
>for 
>that.  I'll probably take a shot at building a class to hold one tree 
>per object, and search for objects of a class (per 
>https://stackoverflow.com/questions/5158830/identify-all-objects-of-given-clas-for-further-processing)
>
>to implement collections when necessary...
>
>It does seem like there might be niche out there for a resource for 
>folks deciding how to structure their package given what they're trying
>
>to provide; i.e. should they construct a collection of functions, or 
>class defs, or...  Could well exist already, and I may just have missed
>
>it...
>
>Thanks,
>Allie
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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.



More information about the R-help mailing list