From hadley at rice.edu  Sat Aug 25 22:47:16 2012
From: hadley at rice.edu (Hadley Wickham)
Date: Sat, 25 Aug 2012 15:47:16 -0500
Subject: [Rd] how to keep the documents of private functions private
In-Reply-To: <8CE91B9EC5614EEC8917892689AD94C0@science.oregonstate.edu>
References: <8CE91B9EC5614EEC8917892689AD94C0@science.oregonstate.edu>
Message-ID: <CABdHhvHjTKMNaE+Rw4XAjMqWunZLLHvE1fEjonq2qjb-=g__Jw@mail.gmail.com>

> To provide some background, a more general question is how to manage unexported (private) functions in an R package. I need to call them during the developing phase or even after the package is released (e.g., for debugging purpose or they may be needed by new functions), but I don?t want to export them (I?d like to keep the number of exported (public) functions to a minimum and present the users with only the functions that they need to know.)

The devtools package allows you to do load_all("path/to/package"),
which simulates installing the package and then loading it (but is
much faster, at the cost of being a somewhat imperfect simulation).
Because working with unexported functions is so useful during
development, it makes all them all available.  (And the development
version allows you to choose whether or not you want them available)

I typically generate documentation with inline source comments (using
roxygen2). If I want them to be turned into Rd files and accessible to
the user I use the roxygen comments (#'). If I just want them to be
available to me (and other developers), I just use # - then they're
available in the source, but not in the man/ directory.

Hadley

-- 
Assistant Professor
Department of Statistics / Rice University
http://had.co.nz/



[Rd] how to keep the documents of private functions private
Hadley Wickham