On 11-09-01 2:27 AM, Eran Eidinger wrote:
Hello,
I wonder how I might create a package that only reveals some of the function
in the package to the user.
I've tried creating an R package using the following:
f<- function(x,y) x+y
g<- function(x,y) x-y
h<- function(x,y) f(x,y)*g(x,y)
package.skeleton(list=c("f","g","h"), name="mypkg")
and would like only h() to be available when I load it, and exposed.
I tried creating a file called NAMESPACE that has one line:
export(h)
But after running R CMD install, when I try to load it with:
library("mypkg",lib.loc=...) i get "Error in namespaceExport(ns, exports) :
undefined exports: h"/
What am I doing wrong?
Your description of what you did sounds like the right thing.
Does your package work without the NAMESPACE file? I.e. are all of f, g
and h visible? I would guess there is something else wrong in it, and h
is really not there.
(BTW, side question, if, after loading, i overload f() or g() with a new
definition from the R console, will h() be affected?)
No.
Duncan Murdoch
Thanks,
Eran Eidinger.
[[alternative HTML version deleted]]
______________________________________________
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.
______________________________________________
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.