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

From: Martin Maechler <maechler_at_stat.math.ethz.ch>
Date: Fri 13 Jan 2006 - 11:42:34 GMT

>>>>> "MM" == Martin Maechler <maechler@stat.math.ethz.ch> >>>>> on Fri, 13 Jan 2006 12:24:51 +0100 writes:

>>>>> "Dieter" == Dieter Menne <dieter.menne@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



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri Jan 13 22:47:10 2006

This archive was generated by hypermail 2.1.8 : Fri 13 Jan 2006 - 16:09:50 GMT