[Rd] package NAMESPACE question
Dirk Eddelbuettel
edd at debian.org
Sat Jan 25 14:53:42 CET 2014
On 25 January 2014 at 14:38, Axel Urbiz wrote:
| Hello,
|
| I'm building a package. My code is stored in foo.R. This code has two
| functions FUN1 and FUN2. FUN1 calls FUN2. FUN1 is listed in export() under
| the package NAMESPACE but NOT FUN2. After building the package when I call
| FUN1 is giving me an error that cannot find FUN2.
Then you are doing something wrong in building, or possibly testing, the package.
"Everything within" can see everything else.
| I solved this by adding FUN2 in the export() NAMESPACE. However, what is
| puzzling me is that I have other examples similar to the above (i.e., one
| function calling another but only one exported) in the same package where I
| don't get the error message.
|
| Any idea of why that might be the case? My understanding is that export
We cannot tell without seeing the code.
I suggest you spend two minutes with package.skeleton(), create an empty
package, put something like these two functions in
multiply <- function(x, k) x * k
timestwo <- function(x) multiply(x, 2)
to convince yourself that timestwo() can in fact use multiply().
| only controls what is visible to the end user but functions not listed in
| export() are still "usable" within the package.
|
| In this case, the reason I'd like to avoid to export FUN2 is so I don't
| have to add it in the package documentation.
|
|
| Any guidance is much appreciated.
|
| Regards,
| Axel.
|
| [[alternative HTML version deleted]]
|
| ______________________________________________
| R-devel at r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-devel
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the R-devel
mailing list