From Mike.Lawrence at DAL.CA  Thu Sep 27 17:57:55 2007
From: Mike.Lawrence at DAL.CA (Mike Lawrence)
Date: Thu, 27 Sep 2007 12:57:55 -0300
Subject: [Rd] Aggregate factor names
Message-ID: <375E8B77-0436-472C-9F85-C56B46DFFEE9@DAL.CA>

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(
		my.dv
		,list(
			one.iv = one.iv
			,another.iv = another.iv
			,yet.another.iv = yet.another.iv
		)
		,some.function
	)
)

to yield a data frame with names = c 
('one.iv','another.iv','yet.another.iv','x') when this seems more  
economical:

with(
	my.data
	,aggregate(
		my.dv
		,list(
			one.iv
			,another.iv
			,yet.another.iv
		)
		,some.function
	)
)

--
Mike Lawrence
Graduate Student, Department of Psychology, Dalhousie University

Website: http://memetic.ca

Public calendar: http://icalx.com/public/informavore/Public

"The road to wisdom? Well, it's plain and simple to express:
Err and err and err again, but less and less and less."
	- Piet Hein



[Rd] Aggregate factor names
Mike Lawrence