From ligges at statistik.tu-dortmund.de  Wed Sep 15 10:55:26 2010
From: ligges at statistik.tu-dortmund.de (Uwe Ligges)
Date: Wed, 15 Sep 2010 10:55:26 +0200
Subject: [Rd] value returned by by()
In-Reply-To: <877hiob1mk.fsf@kolob.sebmags.homelinux.org>
References: <87vd69b8f6.fsf@kolob.sebmags.homelinux.org>	<4C8F481C.8010502@statistik.tu-dortmund.de>
	<877hiob1mk.fsf@kolob.sebmags.homelinux.org>
Message-ID: <4C9089FE.40704@statistik.tu-dortmund.de>



On 14.09.2010 20:50, Seb wrote:
> On Tue, 14 Sep 2010 12:02:04 +0200,
> Uwe Ligges<ligges at statistik.tu-dortmund.de>  wrote:
>
>> It returns a list with athe class attribut set to "by", just use: x<-
>> by(.....)  unclass(x)
>
> Thanks Uwe, however, that still returns an array when using the
> data.frame method for by():
>
> R>  class(unclass(with(warpbreaks, by(warpbreaks[, 1:2], tension, summary))))
> [1] "array"
>
> It seems as if the only way to really ensure a list:
>
> R>  class(lapply(unclass(with(warpbreaks, by(warpbreaks[, 1:2], tension, summary))), function(x) x))
> [1] "list"
>
> but it seems like a waste to call another function just to do this.
>
>

Then you could still do

x <- by(.....)
attributes(x) <- NULL

Uwe



[Rd] value returned by by()
Uwe Ligges