Skip to content
Prev 140062 / 398502 Next

S4 : package creation

Hi Christophe -- 

In terms of documentation, see ?promptClass, ?promptMethods.

I don't think the description of package creation in 'S4 Classes in 15
pages, more or less' is the way things are generally done these
days. A package might normally look like

DESCRIPTION
NAMESPACE
R/AllClasses.R
R/methods-SomeClass.R

The content and organization of the files in the R directory are up to
the package author, but consist of the usual

setClass("A", ...
setMethod("foo", ...

as well as other code. The content of DESCRIPTION and NAMESPACE are
described in the 'Writing R Extensions' manual; important points are
to Depends: methods and LazyLoad: yes in the DESCRIPTION file. It is
also good to arrange that the files in the R directory are sourced in
such a way that classes are defined before the methods that use them
(using Collate: in the DESCRIPTION).

There are a number of example packages available, including those
written specifically for illustrating these issues. Several of these
were referenced in recent threads on this news group, or perhaps it
was the R-devel news group.

Martin

Christophe Genolini <cgenolin at u-paris10.fr> writes: