[EMAIL PROTECTED] wrote:

What is a good way to create a matrix of index variables based on all possible combinations of a list of factors in a data-frame, say list(age, sex)? "age" and "sex" are numeric and factor variables in a dataframe, with 99 and 2 values, respectively.
I would like to use these for subsetting the data-frame, apply functions to subset and collecting the results.



Rather than creating a new index, I think you want the function "by()". Something like


foo <- by(mydata,list(age=mydata$age, sex=mydata$sex), your.summary.function)

Cheers

Jason
--
Indigo Industrial Controls Ltd.
http://www.indigoindustrial.co.nz
64-21-343-545
[EMAIL PROTECTED]

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to