[R] exporting methods/classes

Uwe Ligges ligges at statistik.uni-dortmund.de
Sun Jan 8 15:09:06 CET 2006


Erin Hodgess wrote:

> Dear R People:
> 
> I'm still struggling with sending methods and classes as part of 
> creating a new package.
> 
> Where does the .onLoad function go?  Within R itself or in a file
> in one of the new package directories?

Simply save the .onLoad function in some .R file (e.g. zzz.R) in the 
package's ./R directory.



> Here are my latest efforts:
> 
> 
> Here's the last part of the woof1-Ex.Rout
> 
> 
>>library('woof1')
> 
> Error in loadNamespace(package, c(which.lib.loc, lib.loc), 
> keep.source = keep.source) : 
> 	in 'woof1' classes for export not defined: dog
> Error: package/namespace load failed for 'woof1'
> Execution halted

So this looks like you have defined S4 classes for export in your 
Namespace but you have no call that starts with

setClass("dog", ......

in the R code in your package, hence the class "dog" is undefined.


> Here's the NAMESPACE
> importFrom(graphics,plot)
> exportClasses("dog")
> exportMethods("plot","show")


You don't export any other functions?


Uwe Ligges




> 
> thanks yet again,
> Sincerely,
> Erin 
> mailto: hodgess at gator.uhd.edu
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list