[Rd] Please explain your workflow from R code -> package -> R code -> package

Dirk Eddelbuettel edd at debian.org
Fri Sep 9 19:42:56 CEST 2011

On 9 September 2011 at 11:38, Paul Johnson wrote:
| Hi,
| I'm asking another one of those questions that would be obvious if I
| could watch your work while you do it.
| I'm having trouble understanding the workflow of code and package maintenance.
| Stage 1.  Make some R functions in a folder.  This is in a Subversion repo
| R/trunk/myproject
| Stage 2. Make a package:
| After the package.skeleton, and R check, I have a new folder with the
| project in it,
| R/trunk/myproject/mypackage
|   man
|   R
| I to into the man folder and manually edit the Rd files. I don't
| change anything in the R folder because I think it is OK so far.
| And eventually I end up with a tarball mypackage_1.0.tar.gz.
| Stage 3. How to make the round trip? I add more R code, and
| re-generate a package.
| package.skeleton obliterates the help files I've already edited.

In my case a lot of 'C-x f' to open a new man/foo.Rd file, maybe a new
src/foo.cpp file, maybe a new unit tests file ...  It all depends.  I tend
then call little one-line shell commands which may rebuild the package and
run test expressions via littler.

But as a general rule, code and documentation (still) gets written (manually)
in an editor.

| So keeping the R code in sync with the documentation appears to be a hassle.

But 'R CMD check' is vigilant and reminds you when you get some details wrong.
| In other languages, I've seen to write the documentation inside the
| code files and then post-process to make the documentation.  Is there
| a similar thing for R, to unify the R code development and
| documentation/package-making process?

You can also follow the cool kids who these days tie some of this together
using roxygen.

And just as a philosophical note: There is (still) no silver bullet.  The
slow boring of thick boards applies not only to politics (as per Max Weber)
but quite conceivably to programming.

Hth, Dirk
| pj
| -- 
| Paul E. Johnson
| Professor, Political Science
| 1541 Lilac Lane, Room 504
| University of Kansas
| ______________________________________________
| R-devel at r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-devel

Two new Rcpp master classes for R and C++ integration scheduled for 
New York (Sep 24) and San Francisco (Oct 8), more details are at

More information about the R-devel mailing list