Sylvain ARCHENAULT wrote:
Hello,

I am trying to make a R package with S4 classes. To do so, i do as usual (when no S4 were involved, i.e without NAMESPACE file) and I've got errors in class refering to other classes in the package.

Probably because the files are collated in such a way that some classes are referenced (in other class definitions or methods) before they are defined? You can use the Collate: field in DESCRIPTION, or adopt a convention such as defining all classes (in a sensible way) in a file such as AllClasses.R (which happens to collate early).

So I use a NAMESPACE file to declare classes, it works fine, but now I have to declare each functions in the NAMESPACE file. Since I have a lot of functions, it's not very easy.

My strategy is to

exportPattern("^[^\\.]")

in NAMESPACE, and use .funcName to mark functions that I don't want to export. This exports the generics and implicitly the methods defined on those generics. If you define methods on generics from other packages, then it's necessary to

exportMethods

an exportMethodsPattern might be a useful addition (either to my knowledge or to R).

Hope that helps

Martin

Is there a way to exports all methods in one statement ? or is there a tool which can help generating the NAMESPACE file ?

Thanks for your help,
Sylvain.

PS: Could you please CC me in your replies since I do not subscribe to the list.
*************************************************************************
This message and any attachments (the "message") are con...{{dropped:15}}

______________________________________________
R-help@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@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.

Reply via email to