From: Thomas Hopper <tomhopper_at_comcast.net>

Date: Mon 21 Mar 2005 - 09:23:55 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Mar 21 09:28:46 2005

Date: Mon 21 Mar 2005 - 09:23:55 EST

Given a data frame with columns labeled A, B, C and D, I would like to generate a data frame with columns that are the combination of each of the columns in the original data frame. The output columns would be A*B, A*C, A*D, A*E, A*B*C, A*B*D,..., A*B*C*D.

Alternatively, I'd want to generate the interactions for a given level (2-factor or 3-factor).

If such a function already exists, I'd be more than happy to use it.

If it doesn't, I can write it, but I would appreciate a little help with the algorithm for generating the combinations...how do I loop through the given factors to generate all possible combinations?

Thanks,

Tom

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Mar 21 09:28:46 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:30:51 EST
*