[R] exporting methods/classes
Jean-Christophe BOUETTE
jcbouette at gmail.com
Tue Jan 10 11:45:36 CET 2006
> ---------- Message transféré ----------
> From: Uwe Ligges <ligges at statistik.uni-dortmund.de>
> To: Erin Hodgess <hodgess at gator.dt.uh.edu>
> Date: Sun, 08 Jan 2006 15:09:06 +0100
> Subject: Re: [R] exporting methods/classes
> 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", ......
>
Well, it's not that easy for a newbie (like me) to track that problem.
Using package.skeleton() (on my old R 2.1.1) puts all the function
definitions in the ./R subdirectory, but not the call to setClass (or
did I make something wrong?). Maybe it's one of the things that should
be documented to make package creation easier. Of course, I know
somebody will point me to some doc where it is stated but the fact is
that it was not obvious.
By the way, I'd like to thank Uwe Ligges and Duncan Murdoch for the
helpful article in R-Help 5/2, it was really useful to me. If I manage
to understand all the steps necessary to make an S4 namespace package
I promise to write a "S4 Package step by step for newbies" :-)
Regards,
Jean-Christophe Bouëtté.
> 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