[R] unique sets of factors

From: Tony Long <tdlong_at_uci.edu>
Date: Thu 19 Oct 2006 - 20:10:52 GMT


I have a matrix, X, with a LARGE number of rows. Consider the following three rows of that matrix:

1 1 1 1 2 2 3 3
1 1 1 1 3 3 2 2
3 3 2 2 1 1 1 1

I wish to fit many one-way ANOVAs to some response variable using each row as a set of factors. For example, for each row above I will do something like anova(lm(Y~as.factor(X[1,]))). My problem is that in the above example, I do not want to fit models for both rows 1 and 2 as they are essentially duplicates in terms of the ANOVA model. Clearly row 3, although it has the same number of 1's, 2's, and 3's, is a different model.

Is there some computationally efficient way to remove such "factor duplicates" from my large matrix? I have been banging my head against the wall all morning.




Tony Long

Ecology and Evolutionary Biology
Steinhaus Hall
University of California at Irvine
Irvine, CA

Tel:  (949) 824-2562   (office)
Tel:  (949) 824-5994   (lab)
Fax: (949) 824-2181

email:  tdlong@uci.edu

R-help@stat.math.ethz.ch mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri Oct 20 06:24:46 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 19 Oct 2006 - 21:30:11 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.