Re: [R] S4 : package creation

From: Martin Morgan <mtmorgan_at_fhcrc.org>
Date: Fri, 21 Mar 2008 10:29:29 -0700

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:

> 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
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M2 B169
Phone: (206) 667-2793

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 21 Mar 2008 - 17:33:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 25 Mar 2008 - 14:30:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive