[Rd] Methods package is now attached by default

John Chambers jmc@research.bell-labs.com
Fri Jan 17 23:02:07 2003

The current r-devel (aka R 1.7.0) now attaches the package "methods" by
default at startup.

A new option, "defaultPackages", is set to c("methods", "ctest") by
default, causing the .First in package base to require those two
packages at startup.

There are two main known differences from having methods attached:

- the definition of class() changes, in particular no object ever has a
NULL class.  If you have code that depends on test such as
`if(is.null(class(x)))...', there may be problems.

Usually code with those sort of tests is doing a workaround of the fact
that not all objects had a class before.  The best solution is usually
to ask what the code really wants to do.  If you do have to retain
exactly the old behavior, one solution is to copy the version of class
and class<- from the base package and use those (as baseClass and
baseClass<-, e.g.) instead of class and class<-).

- the function plot has arguments (x,y,...) (to allow methods for the
y-axis argument) instead of (x, ...) in package base.  S3-style plot
methods are still dispatched, but there are possible incompatibilities
from calls to plot() with _unnamed_ arguments (other than x) intended
for these methods.

See ?Startup for how the defaultPackages option affects startup (& for
ways to change the packages attached at startup).
John M. Chambers                  jmc@bell-labs.com
Bell Labs, Lucent Technologies    office: (908)582-2681
700 Mountain Avenue, Room 2C-282  fax:    (908)582-3340
Murray Hill, NJ  07974            web: http://www.cs.bell-labs.com/~jmc