-----Original Message-----
From: r-sig-mixed-models-bounces at r-project.org [mailto:r-sig-mixed-models-
bounces at r-project.org] On Behalf Of Ben Bolker
Sent: Wednesday, November 13, 2013 16:19
To: r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] lmList from lme4 on grouped data objects
Viechtbauer Wolfgang (STAT <wolfgang.viechtbauer at ...> writes:
Dear lme4-Maintainers,
As far as I can tell, lmList() from lme4 does not
play nicely with grouped data objects from the nlme package. Example:
library(lme4)
data(Orthodont, package="nlme")
class(Orthodont)
### [1] "nfnGroupedData" "nfGroupedData" "groupedData" "data.frame"
res <- lmList(distance ~ age | Subject, data=Orthodont)
### Error in eval(expr, envir, enclos) : object 'Subject' not found
### In addition: Warning message:
### In Ops.ordered(age, Subject) : '|' is not
meaningful for ordered factors
Orthodont <- as.data.frame(Orthodont)
res <- lmList(distance ~ age | Subject, data=Orthodont)
### works
This had me stumped for a while, so I figured I would note this here (in
case anybody else runs into this
This is a good point. The code of lmList actually has a
line converting the 'data' argument via 'as.data.frame', but
it doesn't work! The reason is a bit subtle -- lmList constructs
its model frame by modifying the call and evaluating it in the
parent frame, so that modifications to 'data' within the function
itself get lost ... I'm not currently sure of the best way to
fix this, so in the meantime I'm adding a comment to the documentation.
There are still some open issues with lmList: in particular, it
doesn't play nicely with the nlme accessor methods:
https://github.com/lme4/lme4/issues/26