On Thu, Feb 1, 2018 at 1:21 AM, Martin Maechler <maech...@stat.math.ethz.ch> wrote:
> >>>>> Michael Lawrence <lawrence.mich...@gene.com> > >>>>> on Tue, 30 Jan 2018 10:37:38 -0800 writes: > > > I agree that it would make sense for the object to have c("by", > "list") as > > its class attribute, since the object is known to behave as a list. > > Well, but that (list behavior) applies to most non-simple S3 > classed objects, say "data.frame", say "lm" to start with real basic ones. > > The later part of the discussion, seems more relevant to me. > Adding "list" to the class attribute seems as wrong to me as > e.g. adding "double" to "Date" or "POSIXct" (and many more such cases). > > There's a distinction though. Date and POSIXct should not really behave as double values (an implementation detail), but "by" is expected to behave as a list (when it is one). For the present case, we should stay with focusing on is.list() > being true after as.list() .. the same we would do with > as.numeric() and is.numeric(). > > Martin > > > However, it would may be too disruptive to make this change at this > point. > > Hard to predict. > > > Michael > > > On Mon, Jan 29, 2018 at 5:00 PM, Dario Strbenac < > dstr7...@uni.sydney.edu.au> > > wrote: > > >> Good day, > >> > >> I'd like to suggest the addition of an as.list method for a by > object that > >> actually returns a list of class "list". This would make it safer > to do > >> type-checking, because is.list also returns TRUE for a data.frame > variable > >> and using class(result) == "list" is an alternative that only > returns TRUE > >> for lists. It's also confusing initially that > >> > >> > class(x) > >> [1] "by" > >> > is.list(x) > >> [1] TRUE > >> > >> since there's no explicit class definition for "by" and no mention > if it > >> has any superclasses. > >> > >> -------------------------------------- > >> Dario Strbenac > >> University of Sydney > >> Camperdown NSW 2050 > >> Australia > >> > >> ______________________________________________ > >> R-devel@r-project.org mailing list > >> https://stat.ethz.ch/mailman/listinfo/r-devel > >> > >> > > > [[alternative HTML version deleted]] > > > ______________________________________________ > > R-devel@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-devel > > [[alternative HTML version deleted]] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel