Skip to content

S4 : package creation

3 messages · Christophe Genolini, Martin Morgan, robin hankin

#
Hi the list,

Using S4, how can we create a package? In "S4 Classes in 15 pages, more 
or less", they put all the classes definition in a function that will be 
called at the opening of the library and they add "by hand" a Rd file. 
Is it the only way ? Is there something like "S4.package.skeleton"?

Thanks

Christophe
1 day later
#
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:

  
    
3 days later
#
One other reference is the vignette in the Brobgingnag
package; this is a cookbook approach that gives step-by-step
instructions on how to build a simple package using S4 methods.

rksh
On 21 Mar 2008, at 17:29, Martin Morgan wrote:

            
--
Robin Hankin
Uncertainty Analyst and Neutral Theorist,
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743