title: String formula for linear models
body: <p>I'm trying to create a string formula with the independent variables that are significant within my linear model, though I'm finding it difficult trying to include the <code>+</code> at the end of each variable.</p>
  <p>I have tried:</p>
  <pre><code>as.formula(sprintf(&quot;encounter ~  %s&quot;,
                     names(tbest$model)[-1]))    
  </code></pre>
  <p>However, this only gives the first variable:</p>
  <pre><code>encounter ~ open_shrubland
  </code></pre>
  <blockquote>
  <p>Warning message:
  Using formula(x) is deprecated when x is a character vector of length &gt; 1.
  Consider formula(paste(x, collapse = &quot; &quot;)) instead.</p>
  </blockquote>
  <p>How would I include all of them such that: <code>encounter ~ X1 + X2 + X3 ...</code>, also, can this be made functional, such that if I wanted to remove a variable, I would only have to do <code>my.formula[-3]</code> to remove it?</p>
  <p>list of variable names:</p>
  <pre><code>c(&quot;open_shrubland&quot;, &quot;Appalachian_Mountains&quot;, &quot;Boreal_Hardwood_Transition&quot;, 
  &quot;Central_Hardwoods&quot;, &quot;Piedmont&quot;, &quot;wetland&quot;, &quot;Badlands_And_Prairies&quot;, 
  &quot;Peninsular_Florida&quot;, &quot;Central_Mixed_Grass_Prairie&quot;, &quot;water&quot;, 
  &quot;New_England_Mid_Atlantic_Coast&quot;, &quot;grassland&quot;, &quot;mixed_forest&quot;, 
  &quot;cropland&quot;, &quot;Oaks_And_Prairies&quot;, &quot;Eastern_Tallgrass_Prairie&quot;, 
  &quot;evergreen_needleleaf&quot;, &quot;year&quot;, &quot;pland_change&quot;, &quot;evergreen_broadleaf&quot;, 
  &quot;Southeastern_Coastal_Plain&quot;, &quot;Prairie_Potholes&quot;, &quot;Shortgrass_Prairie&quot;, 
  &quot;urban&quot;, &quot;Prairie_Hardwood_Transition&quot;, &quot;Lower_Great_Lakes_St.Lawrence_Plain&quot;, 
  &quot;mosaic&quot;, &quot;Mississippi_Alluvial_Valley&quot;, &quot;deciduous_broadleaf&quot;, 
  &quot;deciduous_needleleaf&quot;, &quot;barren&quot;)
  </code></pre>