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: erinm.hodgess at gmail.com [[alternative HTML version deleted]]
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 <erinm.hodgess at gmail.com> 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: erinm.hodgess at gmail.com > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org 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]]
... 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 <btupper at bigelow.org> 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 <erinm.hodgess at gmail.com> > 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: erinm.hodgess at gmail.com > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help at r-project.org 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]] > > ______________________________________________ > R-help at r-project.org 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]]
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
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 <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.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
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, > Erinsee ?prompt -- Enrico Schumann Lucerne, Switzerland http://enricoschumann.net