[R] algorithm -- generating combinations

Lukas Kubin lukas.kubin at permonik.com
Sat May 4 10:14:52 CEST 2002

Hash: SHA1

I would like to code a script which processess all possible combinations
of matrix columns. The purpose of such operation is to automatically find
best combination of factors (not those factors in mean of R, but
explaining factors -- independent variables) received from lm(). The
independent variables are present in columns of the matrix.
I am not a skilled programmer and I would like to ask someone to help me
create an algorithm generating the factors' combination so that I can work
with them further. What I need is: Let's say I have 3 matrix columns --
x1, x2, x3. The algorithm returns combinations x1 x2 x3; x1 x2; x2 x3; x1
x3; x1; x2; x3. It should also allow to limit the resulting set of
variables to contain at least a given number of items. For example: limit
is 2, algorithm returns x1 x2 x3; x1 x2; x2 x3 and x1 x3.
Which format should be the returned result? A vector? I will need to use
it way like: matrix[, c(1, 2, 3)] for a returned set x1 x2 x3.

I am almost sure all I am looking for has someone already done. I will
appreciate any help.
Thank you.


- -- 
Lukas Kubin
lukas.kubin at permonik.com
phone: 00420603836180
Version: GnuPG v1.0.5 (GNU/Linux)
Comment: Made with pgp4pine 1.75-6


r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list