title: Creating a loop through a list of variables for an LM model in R
body: <p>I am trying to create multiple linear regression models from a list of variable combinations (I also have them separately as a data-frame if that is more useful!)</p>
  
  <p>The list of variables looks like this:</p>
  
  <pre><code>Vars
  x1+x2+x3
  x1+x2+x4
  x1+x2+x5
  x1+x2+x6
  x1+x2+x7
  </code></pre>
  
  <p>The loop I'm using looks like this:</p>
  
  <pre><code>for (i in 1:length(var_list)){
    lm(independent_variable ~ var_list[i],data = training_data)
    i+1
  }
  </code></pre>
  
  <p>However it is not recognizing the string of <code>var_list[i]</code> which gives <code>x1+x2+x3</code> etc. as a model input.</p>
  
  <p>Does any-one know how to fix it?</p>
  
  <p>Thanks for your help.</p>