Re: [R] Automated generation of combinations

2011-09-12 Thread Andrej Blejec
-- Organizer: Applied Statistics 2011 conference http://conferences.nib.si/AS2011 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Santiago Guallar > Sent: Monday, September 12, 2011 2:45 PM > To: r-help@r-

Re: [R] Automated generation of combinations

2011-09-12 Thread Dimitris Rizopoulos
one option is the following: varNames <- c("varA", "varB", "varC", "varD") f <- function (i) { combn(length(varNames), i, function (x) paste(varNames[x], collapse = " + ")) } lapply(seq_along(varNames), f) However, in case you're interested in performing a linear regression with t

[R] Automated generation of combinations

2011-09-12 Thread Santiago Guallar
Hello,   I'd like to generate automatically all the possible combinations of a set of 8 variables (there are 535, too many to do it by hand). For example:   input: varA, varB, varC output: varA+varB+varC varA+varB varA+varC varB+varC varA