title: Pass a vector of variables into lm() formula
body: <p>I was trying to automate a piece of my code so that programming become less tedious.</p>
  
  <p>Basically I was trying to do a stepwise selection of variables using <code>fastbw()</code> in the <strong>rms</strong> package. I would like to pass the list of variables selected by <code>fastbw()</code> into a formula as <code>y ~ x1+x2+x3</code>, "x1" "x2" "x3" being the list of variables selected by <code>fastbw()</code></p>
  
  <p>Here is the code I tried and did not work</p>
  
  <pre><code>olsOAW0.r060 &lt;- ols(roll_pct~byoy+trans_YoY+change18m, 
                      subset= helper=="POPNOAW0_r060", 
                      na.action = na.exclude, 
                      data = modelready)
  
  OAW0 &lt;- fastbw(olsOAW0.r060, rule="p", type="residual", sls= 0.05)
  
  vec &lt;- as.vector(OAW0$names.kept, mode="any")
  
  b &lt;- paste(vec, sep ="+") ##I even tried b &lt;- paste(OAW0$names.kept, sep="+")
  
  bestp.OAW0.r060 &lt;- lm(roll_pct ~ b , 
                        data = modelready, 
                        subset = helper =="POPNOAW0_r060",    
                        na.action = na.exclude)
  </code></pre>
  
  <p>I am new to R and still haven't trailed the steep learning curve, so apologize for obvious programming blunders. </p>