title: Automatically create formulas for all possible linear models
body: <p>Say I have a training set in a data frame <code>train</code> with columns <code>ColA</code>, <code>ColB</code>, <code>ColC</code>, etc. One of these columns designates a binary class, say column <code>Class</code>, with "yes" or "no" values.</p>
  
  <p>I'm trying out some binary classifiers, e.g.:</p>
  
  <pre><code>library(klaR)
  mynb &lt;- NaiveBayes(Class ~ ColA + ColB + ColC, train)
  </code></pre>
  
  <p>I would like to run the above code in a loop, automatically generating all possible combinations of columns in the formula, i.e.:</p>
  
  <pre><code>mynb &lt;- append(mynb, NaiveBayes(Class ~ ColA, train)
  mynb &lt;- append(mynb, NaiveBayes(Class ~ ColA + ColB, train)
  mynb &lt;- append(mynb, NaiveBayes(Class ~ ColA + ColB + ColC, train)
  ...
  mynb &lt;- append(mynb, NaiveBayes(Class ~ ColB + ColC + ColD, train)
  ...
  </code></pre>
  
  <p>How can I automatically generate formulas for each possible linear model involving columns of a data frame?</p>