This is great, thank you so much!
On Mon, Apr 7, 2025 at 3:32 PM Jeff Newmiller <jdnew...@dcn.davis.ca.us> wrote: > My opinion is that you should use S3 unless you absolutely need some > syntactic sugar only offered by some other object system. > > Note that in a majority of cases you want to transform one standard data > structure to another... tibble to tibble is the fashion for dplyr... and > functions can often do what you want just fine except that they sometimes > end up needing a lot of arguments that you want to refer to in many places. > You can often make a class that holds those arguments so they can be > re-used and where the class has methods to do the desired transformation > (s) where the bulk data remains handled as arguments and return values > rather than as data in the object itself. > > The lm class in base R uses a "constructor computes and methods retrieve > results" approach... which isn't quite as flexible as a transformer > approach but still hides the gory details. > > My reason for giving these examples is that the functional/OO approach > expresses problems quite cleanly using S3... and you don't have to pay the > performance/hoop-jumping/extra dependencies that you need for R5 or R7. > That is, you should think carefully about whether you really need whatever > features that more advanced OO system offers... and then you will know the > answer to the question you posed for yourself. > > On April 7, 2025 10:35:44 AM PDT, Erin Hodgess <erinm.hodg...@gmail.com> > wrote: > >Hello everyone! > > > >I have an opinion question please. If I’m writing a new package, would > you > >recommend using S3 or S4 structure, please? > > > >I know I will get lots of opinions, but that’s fine. > > > >Thanks, > >Erin > > > > > >Erin Hodgess, PhD > >mailto: erinm.hodg...@gmail.com > > > > [[alternative HTML version deleted]] > > > >______________________________________________ > >R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > >https://stat.ethz.ch/mailman/listinfo/r-help > >PLEASE do read the posting guide > https://www.R-project.org/posting-guide.html > >and provide commented, minimal, self-contained, reproducible code. > > -- > Sent from my phone. Please excuse my brevity. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.