From lawrence.michael at gene.com  Tue Jan 30 19:37:38 2018
From: lawrence.michael at gene.com (Michael Lawrence)
Date: Tue, 30 Jan 2018 10:37:38 -0800
Subject: [Rd] as.list method for by Objects
In-Reply-To: <SY3PR01MB07474F9CEBBC61FD2A152E58CDE40@SY3PR01MB0747.ausprd01.prod.outlook.com>
References: <SY3PR01MB07474F9CEBBC61FD2A152E58CDE40@SY3PR01MB0747.ausprd01.prod.outlook.com>
Message-ID: <CAOQ5NyeqQCKRKEb6BC8PCV=EojhmjRvqyvkona0hx6mZP8uq0g@mail.gmail.com>

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.
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 <dstr7320 at 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 at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

	[[alternative HTML version deleted]]



[Rd] as.list method for by Objects
Michael Lawrence