[R-sig-ME] lmer bug
Douglas Bates
bates at stat.wisc.edu
Fri Aug 17 18:32:56 CEST 2012
On Thu, Aug 16, 2012 at 3:28 PM, Joehanes, Roby (NIH/NHLBI) [F]
<roby.joehanes at nih.gov> wrote:
> Hi all:
>
> This appears to be a bug affecting lmer that is in the Subversion up until the current version (1788).
>
> The following works:
> ff1 <- Reaction ~ Days + (Days|Subject)
> fm1 <- lmer(ff1, sleepstudy)
> print (anova(fm1))
>
> But the following does not:
> fun <- function () {
> ff1 <- Reaction ~ Days + (Days|Subject)
> fm1 <- lmer(ff1, sleepstudy)
> return (anova(fm1))
> }
> print(fun())
>
> Error message:
> Error in print(fun()) :
> error in evaluating the argument 'x' in selecting a method for function 'print': Error in eval(expr, envir, enclos) : object 'ff1' not found
>
> This error, however, does not affect the lme4 package released in CRAN.
This error in the development version is probably due to the tricky
business of when exactly a formula is evaluated. A formula records
the environment in which it is evaluated and that is the default
environment for some later evaluations. In an attempt to accommodate
certain corner cases where the formula is given as a character string
the evaluation of the formula was changed. Myself I would rather have
cases like this work than character strings for formulas but I think
we will need to wait until Ben is available again to look as this
More information about the R-sig-mixed-models
mailing list