This problem is documented, admittedly not as clearly as it should be: from ?lmList
:
‘data’ should be a data frame (not, e.g. a ‘groupedData’ object from the ‘nlme’ package); use ‘as.data.frame’ first to convert the data.
The reason you're encountering trouble and the authors didn't is that they pulled the Orthodont
data from the MEMSS
package (where it is stored as a regular data frame, not a groupedData
object) rather than from nlme
.
For reasons that I don't remember right now, doing the conversion from groupedData
to data.frame
automatically (which would be the sensible thing to do) is harder than it seems because of the way the code is designed.
This is also discussed at https://stat.ethz.ch/pipermail/r-sig-mixed-models/2013q4/021283.html and https://github.com/lme4/lme4/issues/26