[R] Generating help files for a function

Berwin A Turlach Berwin.Turlach at gmail.com
Sat Dec 16 16:15:27 CET 2017


G'day Erin,

On Sat, 16 Dec 2017 08:00:38 -0600
Erin Hodgess <erinm.hodgess at gmail.com> wrote:

> I'm in the process of writing a package, and I'm using the lovely "R
> Package" book as a guideline.
> 
> However, in the midst of my work,  I discovered that I had omitted a
> function and am now putting in it the package.  Not a problem.  But
> the problem is the help file.  What is the best way to generate a
> help file "after the fact" like that, please?

It depends on how you decided to write the documentation.  If you
follow the "R Package" guidelines and use roxygen2, just add the
comments for the documentation at the beginning of the file and follow
the procedure outline in "R Packages" book.

If you are writing the documentation separate, more like the "Writing R
Extensions" manual, then (1) start R, (2) source the file in which the
function is so that is is in your workspace, (3) say "prompt(foo)" if
the function's name is foo and (4) copy the resulting foo.Rd into
the /man directory of your package.

Cheers,

	Berwin



More information about the R-help mailing list