[R] a question regarding updating formulas with coefficients

Jarrett Byrnes byrnes at msi.ucsb.edu
Thu Aug 12 00:03:19 CEST 2010

I have formulae with coefficents that I would like to update.  However, I get some strange results.  For example, see the following:

For the formula y ~ d+ 3*r+t I want to add a variable p, so

> update(y~d+0*r+t, .~.+p)


y ~ d + t + p - 1

If the coefficient is not 0, but rather, something else - say, 3, I get the following:

> update(y~d+3*r+t, .~.+p)

Error in terms.formula(tmp, simplify = TRUE) : 
  invalid model formula in ExtractVars

Is there a way to do this, or a different call I should be trying?


More information about the R-help mailing list