This too is a question, not really an attempt to provide an answer.
What has happened with the proposed S7 object that can loosely be seen as an
effort to somewhat merge S3 and S4 and perhaps more?
Back to what Erin wrote that is interesting.
If a package creates stand-alone objects that are pretty much only created and
manipulated within the object, then indeed the choice of S3 over S4 may not
matter as much. But in his examples, there is the point that an object that is
related to other well-known objects is designed well, it may be possible for it
to be used more broadly, often without losing the added functionality. This can
be a huge plus and prevent a need to reinvent a parallel set of functions just
to do about the same thing on an object that is now one-of-a-kind.
Of course, as mentioned, the users matter and unless they are equipped with the
appropriate versions of R and related packages, too new an approach may not suit
their needs. In any case, your documentation and code may need to reflect making
sure the needs are understood and met. But, by now, I suspect S4 is also pretty
much as easy to be supported as S3, albeit I have no idea if S7 is even out
there, let alone properly supported.
My personal bias is that object-oriented programming may be best performed using
language features designed for it. Arguably, R has some kludges in how S3 was
created and extended and S4 in some sense is designed to be a bit more suitable.
Other languages have much more robust designs, albeit maybe only from my
perspective, including some where everything is a fully-fledged object.
But I leave it up to people who regularly create projects using S3 or S4 or both
to comment on the realities.
-----Original Message-----
From: R-help <r-help-bounces at r-project.org> On Behalf Of Eric Berger
Sent: Monday, April 7, 2025 4:20 PM
To: Erin Hodgess <erinm.hodgess at gmail.com>
Cc: r-help at r-project.org
Subject: Re: [R] An opinion question, please
As Bert indicated, the more information you can provide about the
package goals and intended users, the more appropriate the answers
will be.
Rob Hyndman and his group have made many contributions to the field of
time series and the sub-field of forecasting, both on the theoretical
and practical sides.
Hyndman et al have created many R packages devoted to time series.
Their basic "object" is a tsibble, which is a subclass of a tibble,
which itself is a subclass of an R DataFrame.
More generally, they have adopted to extend Posit's "tidyverse" to
a
"tidyverts" (where 'ts' stands for time series), so that many
commonly
used packages/functions in the tidyverse can do the appropriate thing
when handed a 'tsibble' as an input, rather than a tibble. e.g.
ggplot2::autoplot( some_tsibble )
Some objects in the tidyverts that seem related to your package include:
dable - a decomposition table, which is a subclass of tsibble, and
which breaks the time series into components (trend, seasonality,
residual)
mable - a model table, used when applying different models to the same
dataset, a fairly common use case
For more information on Hyndman's approach to time series forecasting
and his R tools, check out his freely available textbook
"Forecasting: Principles and Practice (3rd Edition)"
https://otexts.com/fpp3/
HTH,
Eric
On Mon, Apr 7, 2025 at 8:46?PM Erin Hodgess <erinm.hodgess at gmail.com>
wrote:>
> Thanks, Bert!
>
> It?s for disaggregation of time series using different underlying
> distributions.
>
>
>
> Erin Hodgess, PhD
> mailto: erinm.hodgess at gmail.com
>
>
> On Mon, Apr 7, 2025 at 11:40?AM Bert Gunter <bgunter.4567 at
gmail.com> wrote:
>
> > My *opinion*:
> >
> > 1. As it stands, this "opinion survey" seems pretty useless;
> > 2. It *might* be more useful if you explained what the package will
do,
> > who it's intended users are, etc.
> >
> > -- Bert
> >
> > "An educated person is one who can entertain new ideas, entertain
others,
> > and entertain herself."
> >
> >
> >
> > On Mon, Apr 7, 2025 at 10:36?AM Erin Hodgess <erinm.hodgess at
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.hodgess at gmail.com
> >>
> >> [[alternative HTML version deleted]]
> >>
> >> ______________________________________________
> >> 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
> >> https://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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
https://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
______________________________________________
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 https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.