Skip to content
Prev 18952 / 63421 Next

update.formula gotcha (PR#8462)

(Reported by S?ren H?jsgaard)

Looks like update.formula is stripping of parentheses in cases where
they shouldn't be
Reaction ~ Days + Days | Subject + I(Days^2)

Notice that the right hand side is interpreted with the bar at the root
of the parse tree, as in
(Days + Days) | (Subject + I(Days^2)):
Days + Days | Subject + I(Days^2)
`|`

This confuses lmer() rather badly:

library(lme4)
example(lmer)
update(fm1,formula = . ~ . + I(Days^2))

   ------>

Error in x[[2]] : object is not subsettable
Error in model.matrix(eval(substitute(~T, list(T = x[[2]]))), frm) :
        unable to find the argument 'object' in selecting a method for function 'model.matrix'