Generating help files for a function

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Generating help files for a function

Erin Hodgess-2
Hello everyone!

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?

Thank you in advance.  Hope everyone is enjoying various holidays.

Sincerely,
Erin


--
Erin Hodgess
Associate Professor
Department of Mathematical and Statistics
University of Houston - Downtown
mailto: [hidden email]

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Generating help files for a function

Ben Tupper-2
Hi,

If you are using roxygen-style function documentation then why not use devtools::document()?  

Ben

 

> On Dec 16, 2017, at 9:00 AM, Erin Hodgess <[hidden email]> wrote:
>
> Hello everyone!
>
> 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?
>
> Thank you in advance.  Hope everyone is enjoying various holidays.
>
> Sincerely,
> Erin
>
>
> --
> Erin Hodgess
> Associate Professor
> Department of Mathematical and Statistics
> University of Houston - Downtown
> mailto: [hidden email]
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.

Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org

Ecocast Reports: http://seascapemodeling.org/ecocast.html
Tick Reports: https://report.bigelow.org/tick/
Jellyfish Reports: https://jellyfish.bigelow.org/jellyfish/




        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Generating help files for a function

Bert Gunter-2
... and please note for the future and in case Ben's reply does not suffice
that such queries should generally go to the r-package-devel mailing list.


Cheers,
Bert



Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Sat, Dec 16, 2017 at 6:36 AM, Ben Tupper <[hidden email]> wrote:

> Hi,
>
> If you are using roxygen-style function documentation then why not use
> devtools::document()?
>
> Ben
>
>
>
> > On Dec 16, 2017, at 9:00 AM, Erin Hodgess <[hidden email]>
> wrote:
> >
> > Hello everyone!
> >
> > 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?
> >
> > Thank you in advance.  Hope everyone is enjoying various holidays.
> >
> > Sincerely,
> > Erin
> >
> >
> > --
> > Erin Hodgess
> > Associate Professor
> > Department of Mathematical and Statistics
> > University of Houston - Downtown
> > mailto: [hidden email]
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>
> Ben Tupper
> Bigelow Laboratory for Ocean Sciences
> 60 Bigelow Drive, P.O. Box 380
> East Boothbay, Maine 04544
> http://www.bigelow.org
>
> Ecocast Reports: http://seascapemodeling.org/ecocast.html
> Tick Reports: https://report.bigelow.org/tick/
> Jellyfish Reports: https://jellyfish.bigelow.org/jellyfish/
>
>
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Generating help files for a function

Berwin A Turlach-3
In reply to this post by Erin Hodgess-2
G'day Erin,

On Sat, 16 Dec 2017 08:00:38 -0600
Erin Hodgess <[hidden email]> 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

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Generating help files for a function

Duncan Murdoch-2
On 16/12/2017 10:15 AM, Berwin A Turlach wrote:

> G'day Erin,
>
> On Sat, 16 Dec 2017 08:00:38 -0600
> Erin Hodgess <[hidden email]> 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.

I'm in the latter camp, but my workflow is slightly different from Berwin's:

After writing a new function and putting it into the package:

1. install the package, and attach it (using library() or require()).
2. use setwd() to change to the man directory.
3. use prompt() to create the skeleton help page.

After that, you edit that new .Rd file, and build the package again.

The first two steps are particularly easy in RStudio:  for 1, just click
"Install and restart" in the build pane, and for 2, navigate in the file
pane to the man directory, and choose "Set as working directory" from
the "More" tab.

Duncan Murdoch

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Generating help files for a function

Enrico Schumann-2
In reply to this post by Erin Hodgess-2
On Sat, 16 Dec 2017, Erin Hodgess writes:

> Hello everyone!
>
> 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?
>
> Thank you in advance.  Hope everyone is enjoying various holidays.
>
> Sincerely,
> Erin

see ?prompt

--
Enrico Schumann
Lucerne, Switzerland
http://enricoschumann.net

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.