Re: [Rd] Aggregate factor names

2007-10-01 Thread Martin Elff
On Thursday 27 September 2007 (17:57:55), Mike Lawrence wrote: > ex. it is annoying to type > > with( > my.data > ,aggregate( > my.dv > ,list( > one.iv = one.iv > ,another.iv = another.iv >  

Re: [Rd] Aggregate factor names

2007-09-27 Thread Prof Brian Ripley
You seem to be assuming that the argument 'by' to the "data frame" method of aggregate() is a call to list() with arguments which are names (and evaluate to factors). When aggregate.data.frame comes to be called, the 'by' argument is a promise to the actual argument. In your example the actual

Re: [Rd] Aggregate factor names

2007-09-27 Thread Gabor Grothendieck
You can do this too: aggregate(iris[-5], iris["Species"], mean) or this: with(iris, aggregate(iris[-5], data.frame(Species), mean)) or this: attach(iris) aggregate(iris[-5], data.frame(Species), mean) The point is that you already don't have to write x = x. The only reason you are writing it

Re: [Rd] Aggregate factor names

2007-09-27 Thread Mike Lawrence
Understood, but my point is that the naming I suggest should be the default. One should not be 'punished' for being explicit in calling aggregate. On 27-Sep-07, at 1:06 PM, Gabor Grothendieck wrote: > You can do this: > > aggregate(iris[-5], iris[5], mean) > > > On 9/27/07, Mike Lawrence <[E

Re: [Rd] Aggregate factor names

2007-09-27 Thread Gabor Grothendieck
You can do this: aggregate(iris[-5], iris[5], mean) On 9/27/07, Mike Lawrence <[EMAIL PROTECTED]> wrote: > Hi all, > > A suggestion derived from discussions amongst a number of R users in > my research group: set the default column names produced by aggregate > () equal to the names of the objec

[Rd] Aggregate factor names

2007-09-27 Thread Mike Lawrence
Hi all, A suggestion derived from discussions amongst a number of R users in my research group: set the default column names produced by aggregate () equal to the names of the objects in the list passed to the 'by' object. ex. it is annoying to type with( my.data ,aggregate(