title: Rename terms in fitted model object
body: <p>I have a list of regression models which all have the same number of terms (that is, the same number of predictive variables). Substantively, that they all have different model terms is right. But when it comes to putting them in a regression table, I want them all the models to share a single formula, simply for the sake of presentation.</p>
  
  <p>Some indicative data</p>
  
  <pre><code>library(plyr)
  d1 &lt;- data.frame(y = rnorm(100),
               x1 = runif(100),
               x2 = runif(100),
               x3 = runif(100),
               x4 = runif(100))
  </code></pre>
  
  <p>Fit the models</p>
  
  <pre><code>mods.form &lt;- paste("y ~ x", 1:4, sep = "")
  mod.list &lt;- llply(mods.form, function(i) lm(i, d1))
  </code></pre>
  
  <p>Here are the terms I want to modify</p>
  
  <pre><code>llply(mod.list, function(i) attr(terms(i), "variables"))
  
  [[1]]
  list(y, x1)
  
  [[2]]
  list(y, x2)
  
  [[3]]
  list(y, x3)
  
  [[4]]
  list(y, x4)
  </code></pre>
  
  <p>I want every model in the list to have the same variable names as the first model, so I tried:</p>
  
  <pre><code>mod.list2 &lt;- llply(mod.list, function(i) attr(terms(i), "variables") = list("y", "x1"))
  </code></pre>
  
  <p>which provides this error</p>
  
  <pre><code>Error in attr(terms(i), "variables") = list("y", "x1") : 
  could not find function "terms&lt;-"
  </code></pre>
  
  <p>Is there a simple solution here?</p>