Re: [Rd] conflict between lme4 and RMySQL packages (PR#9753)

From: <>
Date: Tue, 26 Jun 2007 10:43:53 +0200 (CEST)

Thank you, Dale.

I think you've revealed a bug in the method dispatch mechanism. I'm adding here a script which confirms your finding and add slightly more insight:


fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)

## MM: First save, then print -- the error is in "print" i.e. show() : s1 <- summary(fm1)
s1 #-> error in printMer() which is hidden :

s1 # --> printMer(x, ..) calls so <- summary(x) at the very beginning ## and indeed, summary(x) -- *inside* printMer() dispatches wrongly !!!! ## whereas top-level, there is no problem :

## maybe here, or then later

## This works fine top-level, but gives non-sense when inside printMer() !! ##
so <- summary(s1) ## does nothing, since s1 *is* already summary.lmer : stopifnot(identical(so, s1)) # ok

## one other symptom of the same problem: showMethods(summary) ## is fine top-level

## whereas it does not see the correct methods when used from inside printMer() ## i.e., also when debugging

>>>>> "db" == dale barr <> >>>>> on Tue, 26 Jun 2007 00:57:22 +0200 (CEST) writes:

    db> Full_Name: Dale Barr
    db> Version: 2.5.1 (patched)
    db> OS: Ubuntu linux x86_64
    db> Submission from: (NULL) (

    db> When RMySQL is loaded in before lme4, the summary() function for lmer objects in     db> the lme4 packages produces the following error:

    db> Error in printMer(object) : no slot of name "status" for this object of class     db> "table"

    db> When RMySQL is loaded AFTER lme4, however, no such error arises. For example,     db> the following code gives the error:

>> library(RMySQL)

    db> Loading required package: DBI
>> library(lme4)

    db> Loading required package: Matrix     db> Loading required package: lattice
>> data(sleepstudy)
>> fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
>> summary(fm1)

    db> Error in printMer(object) : no slot of name "status" for this object of class     db> "table"

    db> Now, here is the exact same code except that lme4 is loaded before RMySQL. The     db> summary function works properly.

>> library(lme4)

    db> Loading required package: Matrix
    db> Loading required package: lattice
    db> library(RMySQL)> library(RMySQL)
    db> Loading required package: DBI

>> data(sleepstudy)
>> fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
>> summary(fm1)
    db> Linear mixed-effects model fit by REML 
    db> Formula: Reaction ~ Days + (Days | Subject) 
    db> Data: sleepstudy 
    db> AIC  BIC logLik MLdeviance REMLdeviance
    db> 1754 1770 -871.8       1752         1744
    db> Random effects:
    db> Groups   Name        Variance Std.Dev. Corr  
    db> Subject  (Intercept) 610.835  24.7151        
    db> Days         35.056   5.9208  0.067 
    db> Residual             655.066  25.5943        
    db> number of obs: 180, groups: Subject, 18

    db> Fixed effects:
    db> Estimate Std. Error t value
    db> (Intercept)  251.405      6.820   36.86
    db> Days          10.467      1.546    6.77

    db> Correlation of Fixed Effects:

    db> (Intr)
    db> Days -0.137
    db> R version 2.5.1 RC (2007-06-22 r42030) 
    db> x86_64-unknown-linux-gnu 

    db> locale:

    db> attached base packages:
    db> [1] "stats"     "graphics"  "grDevices" "utils"     "datasets"  "methods"  
    db> [7] "base"     

    db> other attached packages:
    db> RMySQL         DBI        lme4      Matrix     lattice 
    db> "0.6-0"     "0.2-3" "0.99875-2" "0.99875-2"   "0.15-11"

    db> ______________________________________________
    db> mailing list     db> mailing list Received on Tue 26 Jun 2007 - 08:45:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 26 Jun 2007 - 12:35:34 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.