[R-pkg-devel] NAMESPACE and S4 classes

Boylan, Ross Ross.Boylan at ucsf.edu
Fri Nov 6 00:52:45 CET 2015


I am trying to update a package from 2010 to the new standards, including adding a NAMESPACE file.   The package has S4 classes, and I'm having some trouble interpreting the manual.

Suppose I have
setClass("MyClass", .....)
MyClass <- function(a, b, c) {...}  # constructor
and various methods for the class

Assuming I want to make the class and everything associated user-visible, I must
exportClass(MyClass)

Do I need to 
export(MyClass)
so the constructor is visible?

Do I need to 
exportMethods()
for the methods of that class?

I take it that if the class uses a name from elsewhere in the system, e.g., it has a "print" method, I must import that too.  Or is it that I only need to import generics that are not in the base package?


More information about the R-package-devel mailing list