title: Updating nlme models after using reformulate()
body: <p>Having a small issue with updating <code>nlme</code> models after using reformulate in the formula argument of <code>lme()</code></p>
  <p>Here is some data</p>
  <pre><code>set.seed(345)
  A0 &lt;- rnorm(4,2,.5)
  B0 &lt;- rnorm(4,2+3,.5)
  A1 &lt;- rnorm(4,6,.5)
  B1 &lt;- rnorm(4,6+2,.5)
  A2 &lt;- rnorm(4,10,.5)
  B2 &lt;- rnorm(4,10+1,.5)
  A3 &lt;- rnorm(4,14,.5)
  B3 &lt;- rnorm(4,14+0,.5)
  score &lt;- c(A0,B0,A1,B1,A2,B2,A3,B3)
  id &lt;- rep(1:8,times = 4, length = 32)
  time &lt;- factor(rep(0:3, each = 8, length = 32))
  group &lt;- factor(rep(c(&quot;A&quot;,&quot;B&quot;), times =2, each = 4, length = 32))
  df &lt;- data.frame(id = id, group = group, time = time,  score = score)
  </code></pre>
  <p>Now say I want to specify the variables as objects outside the <code>lme</code> function...</p>
  <pre><code>t &lt;- &quot;time&quot;
  g &lt;- &quot;group&quot;
  dv &lt;- &quot;score&quot;
  </code></pre>
  <p>...and then reformulate them...</p>
  <pre><code>mod1 &lt;- lme(fixed = reformulate(t, response = &quot;score&quot;),
              random = ~1|id, 
              data = df)
  
  summary(mod1)
  
  Linear mixed-effects model fit by REML
   Data: df 
         AIC      BIC    logLik
    101.1173 109.1105 -44.55864
  
  Random effects:
   Formula: ~1 | id
          (Intercept)  Residual
  StdDev:   0.5574872 0.9138857
  
  Fixed effects: reformulate(t, response = &quot;score&quot;) 
                  Value Std.Error DF   t-value p-value
  (Intercept)  3.410345 0.3784804 21  9.010626       0
  time1        3.771009 0.4569429 21  8.252693       0
  time2        6.990972 0.4569429 21 15.299445       0
  time3       10.469034 0.4569429 21 22.911036       0
   Correlation: 
        (Intr) time1  time2 
  time1 -0.604              
  time2 -0.604  0.500       
  time3 -0.604  0.500  0.500
  
  Standardized Within-Group Residuals:
         Min         Q1        Med         Q3        Max 
  -1.6284111 -0.5463271  0.1020036  0.5387158  2.1784156 
  
  Number of Observations: 32
  Number of Groups: 8 
  </code></pre>
  <p>So far so good. But what if we want to add terms to the fixed effects portion of the model using <code>update()</code>?</p>
  <pre><code>mod2 &lt;- update(mod1, reformulate(paste(g,&quot;*&quot;,t), response = &quot;score&quot;))
  </code></pre>
  <p>We get the error message</p>
  <pre><code>Error in reformulate(t, response = &quot;score&quot;) : 
    'termlabels' must be a character vector of length at least one
  </code></pre>
  <p>Obviously I can write the model out again without using <code>update()</code> but I was just wondering if there is a way to make update work.</p>
  <p>I gather the problem lies in the way that <code>lme</code> encodes the formula argument when using <code>reformulate</code>.</p>
  <p>Any solution much appreciated.</p>