[R] "infinite recursion" in do.call when lme4 loaded only

Dieter Menne dieter.menne at menne-biomed.de
Thu Jan 12 17:54:30 CET 2006

A larg program which worked with lme4/R about a year ago failed when I
re-run it today. I reproduced the problem with the program below.

-- When lme4 is not loaded, the program runs ok and fast enough
-- When lme4 is loaded (but never used), the do.call fails
   with infinite recursion after 60 seconds. Memory used increases
   beyond bonds in task manager.
-- I tested a few S3 based packages (MASS, nlme) and did not get
   similar problems

Current workaround: do lme4-processing in a separate program.

#library(lme4) # uncomment this to see the problem
np <- 12
nq <- 20
nph <- 3
nrep <- 30
grd <- expand.grid(Pat=as.factor(1:np),
df <- with (grd,
  data.frame(Pat=Pat,Q=Q,Phase=Phase,Resp = rnorm(np*nq*nph*nrep)))

score <- function(x) {
 data.frame(Pat=x$Pat[1],Phase=x$Phase[1],Q=x$Q[1],score = mean(x$Resp))

# about 20 sec
caScore <- by(df,list(Pat=df$Pat,Phase=df$Phase,Q=df$Q),FUN = score )

ca1 = do.call("rbind",caScore)
# Without lme4: 3 seconds
# With lme4: After 60 sec:
#Error: evaluation nested too deeply: infinite recursion /


platform i386-pc-mingw32
arch     i386
os       mingw32
system   i386, mingw32
major    2
minor    2.1
year     2005
month    12
day      20
svn rev  36812
language R

More information about the R-help mailing list