[R] Proper way to implement package internal functions
hanson at depauw.edu
Wed Jun 12 16:44:56 CEST 2013
[previously posted on Stack Overflow: http://stackoverflow.com/questions/17034309/hiding-undocumented-functions-in-a-package-use-of-function-name ]
I've got some functions I need to make available in a package, and I don't want to export them or write much documentation for them. I'd just hide them inside another function but they need to be available to several functions so doing it that way becomes a scoping and maintenance issue. What is the right way to do this? By that I mean do they need special names, do they go somewhere other than the R subdirectory, can I put them in a single file, etc? I've checked out the manuals (e.g. Writing R Extensions 1.6.1), and what I'm after is like the .internals concept in the core, but I don't see any instructions about how to do this generally.
For example, if I have functions foo1 and foo2 in a file foofunc.R, and these are intended for internal use only, should they be called foo1 or .foo1? And the file that holds them, should it be .foofunc.R or foofunc-internals? What should the Rd look like, or do I even need one?
I know people do this in packages all the time and I feel like I've seen this somewhere, but I can't find any resources just now. Perhaps a suggestion of a package that does things this way which I could study would be sufficient.
More information about the R-help