[R-sig-ME] possible side effect of gdata library on dotplot of random terms

espesser robert.espesser at lpl-aix.fr
Tue Dec 8 18:53:06 CET 2009

Here is a reproducible example:

# begin of a  new session of R
 > sessionInfo()
R version 2.8.1 (2008-12-22)


attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base    

loaded via a namespace (and not attached):
[1] grid_2.8.1         lattice_0.17-17    lme4_0.999375-28   

##### REM:  I got  same results with a scratch install of R 2.10.0

 > library(lme4)
 > data(sleepstudy)
 > fm2 <- lmer(Reaction ~ Days + (1|Subject),data=sleepstudy)
 > dotplot(ranef(fm2))

# dotplot OK

 > library(gdata)
 > dotplot(ranef(fm2))
# dotplot  not in order

# the suggestion of Kevin Wright  seems OK :
 >Maybe just copy the correct version of the function into .GlobalEnv
 >so that it is first on the search path:

# OK

Douglas Bates a écrit :
> My suggestion would be not to use gdata. :-)
> More seriously, as I understand it you are saying that gdata provides
> a method for reorder that is not upwardly compatible with the method
> in the stats package.  If so, I would regard this as a flaw in the
> design of the gdata package.   One should not willfully change the
> behavior of functions in required packages.
> Having said that, I am a bit confused by your saying that dotplot
> seems to be using the method from the stats package but it does not
> provide the desired reordering when gdata is attached in the search
> path before stats.  The first part (continuing to use the method from
> stats) is what I would expect to happen.  This is exactly what
> namespaces are for - to seal the set of functions and methods that are
> seen inside the lme4 package.  What I don't understand is why the plot
> does not then work as before.
> Could you provide us with a reproducible example and the output of
> sessionInfo() please?
> On Tue, Dec 8, 2009 at 3:43 AM, espesser <robert.espesser at lpl-aix.fr> wrote:
>> Dear all
>> It seems there is a name conflict between the reorder.factor() function
>> from the package "gdata" and the reorder.factor() from the package "stats" .
>> After loading the  library "gdata", dotplot(ranef( model_object.lmer)  )
>> - which seems using internally  by default reorder.factor()  from the
>> package "stats"  -
>> does not plot the random terms sorted any more .
>> The regular behavior can be recovered with:
>> detach("package:gdata",unload=T)
>> but is there an easier or a more convenient way ?
>> Thank you for your help
>> R. Espesser
>> CNRS - Université de Provence
>> Laboratoire Parole & Langage
>> 5 avenue Pasteur
>> BP 80975
>> 13604 Aix en Provence Cedex 1 (France)
>> web : www.lpl-aix.fr/~espesser
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

More information about the R-sig-mixed-models mailing list