Skip to content
Prev 8017 / 63424 Next

Installing packages using methods: was Re: setGeneric(); R CMD check

Just to wrap up this thread, for now.

A section has been added to ?INSTALL with hints on installing packages
that use the methods package:

     Packages that require the methods package, and that use functions
     such as `setMethod' or `setClass', should be installed by creating
     a binary image.

     The package should require the methods package, both during
     installation and when the user attaches the package.  A good
     solution for most cases is to include the line
     `require("methods")' twice, once at the beginning of the package's
     R source, and once in the file `install.R' in the package
     directory (the top-level directory, not in the `R' directory below
     that).  The `install.R' file causes an image to be saved, and the
     contents will ensure that methods are available when the package
     is attached.

The suggestions seem to work, at least on some simple tests.  I'm not
aware of situations where this fails, but let me know otherwise.

The documentation should be in the next beta or rsync,  also in the
windows INSTALL help file (but I don't have a way to test that), plus a
pointer in the R-exts document to the online help page.

John