[R] Conflict between 'nlme' and 'methods' on R-1.5.0 ?

Douglas Bates bates at stat.wisc.edu
Fri May 10 20:26:28 CEST 2002

"Charis Tzagarakis" <htzag at umn.edu> writes:

> I use R with the packages 'nlme' and 'methods'.Upon upgrading to R1.5.0, I got the following 
> message when loading nlme (after having loaded 'methods'):
> The following object(s) are masked from package:methods :
>          initialize 
>  After that, when I use my class definitions and scripts(which worked fine in 1.4.1) I get the 
> following error message when a new("class") expression is used:
> Error in initialize(value, ...) : no applicable method for "initialize"

> Clearly the problem arises because 'nlme' contains an 'initialize'
> function, as does the new 'methods' package.


> Is there any workaround?

Well loading the packages in the other order avoids the warning but
then lme and related model-fitting functions don't work.  :-)

In the long term this problem will be solved by namespaces
(anticipated by R-1.6.0) and by rewriting the nlme package to use
S4-style classes and methods.

In the short term we could rename initialize as Initialize in the nlme
package but I don't want to do that because the initialize function is
explicitly mentioned in Pinheiro and Bates (Springer, 2000).  Also
this runs the risk of breaking other code that depends on the nlme

You could do that as a "quick and dirty" workaround.  Download the
sources for the nlme package, rename it, substitute "Initialize" for
"initialize" in all the .R files in the R directory, and install the

I will check with other members of R-core to see if anyone can come up
with a more elegant fix.

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list