[R] Information on objects of "class by"

Guilherme Veiga da Rocha gvrocha at stat.Berkeley.EDU
Thu Jul 5 18:48:54 CEST 2007

	Hi all,
	Does anyone know where to find more information on the "by" class?
	Does anyone know how to coerce an object of the "by" class into a  
data.frame containing the results of FUN and the values of the  
grouping variables?
	Does anyone know how to do the following:
	I have a big table with the results of many replications of an  
experiment and I want to summarize the medians according to the  
experimental parameters used.
	Columns 1-6 index the parameters used in that particular replication.
	Column 7 is just an index to the replication number.
	Column 8 is the variable I want to summarize
	I did:
	x=by(model.errors[, 8], model.errors[, 1:6], median)
	I now have an object of class "by" that seems to contain everything  
I need.
	If I just output "x" to the screen, I see all I need: the median for  
each unique combination of values in model.errors[, 1:6].
	However, I only know how to access the information on the medians  
themselves by getting x[i] where i is the index of the median I want.
	The problem is:
	- How do I retrieve the combination of values in model.errors[, 1:6]  
for a given index "i".
	- How do I determine the correct index "i" for a particular  
combination of the values in model.errors[, 1:6]?
	Just to help the thinking: I bypassed this problem for the mean by  
using lm and predict.
	I could in principle do the same using the L1 loss instead of the L2  
loss in lm by I do not know how to do that...
	This seems a rather convoluted solution for a problem "by" is meant  
to solve easily...
	Any help is appreciated.
	Thanks a lot,
	Guilherme Rocha

More information about the R-help mailing list