[R] "infinite recursion" in do.call when lme4 loaded only
Martin Maechler
maechler at stat.math.ethz.ch
Fri Jan 13 12:42:34 CET 2006
>>>>> "MM" == Martin Maechler <maechler at stat.math.ethz.ch>
>>>>> on Fri, 13 Jan 2006 12:24:51 +0100 writes:
>>>>> "Dieter" == Dieter Menne <dieter.menne at menne-biomed.de>
>>>>> on Thu, 12 Jan 2006 18:14:32 +0000 (UTC) writes:
Dieter> Peter Dalgaard <p.dalgaard <at> biostat.ku.dk> writes:
>>> > 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 loaded (but never used), the do.call fails
>>> > with infinite recursion after 60 seconds. Memory used increases
>>> > beyond bonds in task manager.
>>>
>>> However, it surely has to do with methods dispatch:
>>>
>>> > system.time(do.call("rbind.data.frame",caScore))
>>> [1] 0.99 0.00 0.99 0.00 0.00
>>>
>>> which provides you with another workaround.
Dieter> Peter, I had increased the optional value already, but I still don't understand
Dieter> what this recursion overflow has to do with the lm4 loading.
MM> Aahh, you've hit a secret ;-) no, but a semi-hidden feature:
MM> lme4 loads Matrix and Matrix activates versions of rbind() and
MM> cbind() which use rbind2/cbind2 which are S4 generics and
MM> default methods that are slightly different than then the
MM> original base rbind() and cbind().
MM> This was a necessity since the original rbind(), cbind() have
MM> first argument "...", i.e. an invalid signature for S4 method
MM> dispatch.
MM> This was in NEWS for R 2.2.0 :
MM> o Experimental versions of cbind() and rbind() in methods package,
MM> based on new generic function cbind2(x,y) and rbind2(). This will
MM> allow the equivalent of S4 methods for cbind() and rbind() ---
MM> currently only after an explicit activation call, see ?cbind2.
MM> And 'Matrix' uses the activation call in its .OnLoad hook.
MM> This is now getting much too technical to explain for R-help, so
MM> if we want to go there, we should move this topic to R-devel,
MM> and I'd like to do so, and will be glad if you can provide more
MM> details on how exactly you're using rbind.
One thing -- very useful for you -- I forgot to add:
You can easily quickly revert the "other cbind/rbind
activation" by using
methods:::bind_activation(FALSE)
so you don't need to unload lme4 or Matrix, and you can
reactivate them again after your special computation by
methods:::bind_activation(on = TRUE)
Martin
More information about the R-help
mailing list