[R] Conflicts using Rcmdr, nlme and lme4

Douglas Bates bates at stat.wisc.edu
Fri Jan 28 12:02:24 CET 2005


CG Pettersson wrote:
> Hello all!
> 
> R2.0.1, W2k. All packages updated.
> 
> I´m heavily dependant on using mixed models. Up til´now I have used
> lme() from nlme as I have been told to. Together with estimable() from
> gmodels it works smooth. I also often run Rcmdr, mostly for quick
> graphics.
> 
> After using Rcmdr, on reopening the R workspace all help libraries for
> Rcmdr (22 !) loads, among them nlme, but not Rcmdr itself. Why? 
> 
> Now I saw on the list yesterday, that lmer() from lme4 offers better
> coding possibilities for crossed random factors, it feels natural to
> switch from lme() to lmer() if estimable() still works on the objects.
> 
> So I installed lme4, but got a conflict with the (auto)loaded nlme:
> 
> 
>>library(lme4)
> 
> Loading required package: Matrix 
> Loading required package: latticeExtra 
> Error in fun(...) : Package lme4 conflicts with package nlme.
>  To attach lme4 you must restart R without package nlme.
> Error: .onLoad failed in loadNamespace for 'lme4'
> Error in library(lme4) : package/namespace load failed for 'lme4'
> 
> Several questions here:
> 
> Why do all these packages autoload, and could I avoid this in some
> way?
> Why a conflict? Isn´t it possible to mask the conflicting parts of
> nlme when loading lme4?

One reason for my recently introducing the name lmer for the revised lme 
function was eventually to remove the conflict of the lme4 package with 
the nlme package.  In current versions of lme4 I still have an lme 
function that generates an S4 object of the S4 class "lme".    Because 
of the conflict of functions of the same name producing different 
classes  of objects I must have the nlme and lme4 packages conflict. 
Right now there are some models that can be fit by the S4-based lme and 
not be lmer.  There are some "infelicities" in the underlying C code for 
lmer when dealing with non-nested vector-valued random effects.  Once I 
track down and fix these infelicies I can remove the lme function from 
the lme4 package and remove the conflict with the nlme package.

> Why are the mixed models tools from the same author(s?) splitted
> between nlme and lme4? Are there any technical reasons not to include
> lmer() in nlme?

Once you have published a book you have committed yourself to a 
particular API for as long as the book remains in print.  I can't easily 
change the way that the lme and related functions in the nlme package 
work because they are documented in our book.  The functions in lme4 
operate in a fundamentally different way, precisely because they are 
designed to handle crossed random effects in addition to nested random 
effects.

The lme4 package is a work in progress.  I am following Eric Raymond's 
Open Source dictum of 'release early and release often'.  There will 
inevitably be inconveniences associated with using developmental code.

I can guarantee that this is the last time that I will fundamentally 
redesign the computational methods and data structures used in fitting 
mixed-effects models.  This is the fifth time I have done it from 
scratch and after this one I am quitting the business.




More information about the R-help mailing list