title: Making a formula in R from a name
body: <p>I have a bunch of predictors:</p>
  
  <pre><code>x&lt;- c("pred1", "pred2", "pred3")
  </code></pre>
  
  <p>I want to write a formula in a for loop as follows:</p>
  
  <pre><code>for (i in 1:length(x)){
     glmfit(y~x[i], data = myDF, family= "binomial")
  }
  </code></pre>
  
  <p>Now, <code>myDF</code> is a data frame where "pred1", "pred2" and "pred3" are columns. Simply putting <code>x[i]</code> however does not work.</p>
  
  <p>Thank you for your help!</p>