[R] Skipping .Rd files and using Org-mode instead?

Charles Berry ccberry at ucsd.edu
Mon Jun 2 23:49:40 CEST 2014


Kevin Wright <kw.stat <at> gmail.com> writes:

> 
> Have you tried the roxygen2 package?
> 

I have.

org-mode + roxygen2 + inline is what was used to make this package:

http://www.bioconductor.org/packages/release/bioc/html/geneRxCluster.html

Everything from the DESCRIPTION file to the C-code to the vignette reside 
in a single org-mode file. Tangling and running a few src-blocks to 
roxygenize() (the documentation and other directives) and to create the
.Call() wrappers (for the C-code) creates the package. 

(I exported the vignette using org-ravel --- that's another story.)

---

And if it isn't obvious from what Kevin said, something like this:

#+BEGIN_SRC R :tangle foo.R :dir <path-to-package-R-dir>
  ##' foo, but not bar
  ##'
  ##' execute the identity op
  ##' @title foo
  ##' @param x any variable
  ##' @return the input value unaltered
  ##' @author Mee Myself Andaye
  foo <-
      function(x) x
#+END_SRC


will serve as a start. `M-x ess-roxy-update-entry' will generate a 
template for all the comment lines, which roxygen2 uses to create Rd and 
other package components.

When in a src-edit buffer, ESS has a bunch of ess-roxy-* functions, like 
ess-roxy-update-entry to generate the template, and ess-roxy-preview-* to 
see how things render. Pulldown the ESS-Roxygen menu to see some good 
choices.

HTH,

Chuck



More information about the R-help mailing list