[R] "infinite recursion" in do.call when lme4 loaded only
Martin Maechler
maechler at stat.math.ethz.ch
Fri Jan 13 12:24:51 CET 2006
>>>>> "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.
Aahh, you've hit a secret ;-) no, but a semi-hidden feature:
lme4 loads Matrix and Matrix activates versions of rbind() and
cbind() which use rbind2/cbind2 which are S4 generics and
default methods that are slightly different than then the
original base rbind() and cbind().
This was a necessity since the original rbind(), cbind() have
first argument "...", i.e. an invalid signature for S4 method
dispatch.
This was in NEWS for R 2.2.0 :
o Experimental versions of cbind() and rbind() in methods package,
based on new generic function cbind2(x,y) and rbind2(). This will
allow the equivalent of S4 methods for cbind() and rbind() ---
currently only after an explicit activation call, see ?cbind2.
And 'Matrix' uses the activation call in its .OnLoad hook.
This is now getting much too technical to explain for R-help, so
if we want to go there, we should move this topic to R-devel,
and I'd like to do so, and will be glad if you can provide more
details on how exactly you're using rbind.
Martin Maechler,
ETH Zurich
More information about the R-help
mailing list