[R] building packages using S4 methods

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jul 30 13:59:59 CEST 2003


On Wed, 30 Jul 2003, Marsland, John wrote:

> I have been building a package around a sequence of S4 classes which I have
> coded in separate *.R files in the "./R" subdirectory of the package.
> The package builds without error, but when I load it in R I get:

[Incidentally, packages with R syntax errors `build without errors': that
is not a useful test.]

> Error in reconcilePropertiesAndPrototype(name, slots, prototype,
> superClasses) :
> 	Class "xxxx" extends an undefined class ("yyyyyy"
> 
> I guess R is trying to source the *.R files in the wrong order? Since both

Or perhaps you didn't give them names in the right order?  The files are
not in fact source-d, but they are concatenated in alphabetical order and 
the concatenated file is parsed and evaluated (at load time unless you 
used --save: see below).

`alphabetical order' is potentially locale-dependent, although we try to 
ensure that the C locale is used, I don't think this is bound to work on 
Windows.

> classes are defined in the package and work fine at the command prompt. 
> Is it just that this has not been an issue before owing to R's lazy
> evaluation?
> Is there anything I can do about this... maybe by putting something in the
> "./install.R"?

How are you building the package?  Are you using --save?  If not, that is 
probably the solution as it is highly recommended for packages using S4 
classes.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list