Simple and sustainable R packaging using inlinedocs

You wrote a bunch of R code, now you want to share it with everyone, so you are making a package. Most likely you have a bunch of functions in a file, and now you have to write all the documentation for them. Now how to go about doing that?

simple example of inlinedocs usage

Then put your code in pkgdir/R/code.file.R, write a pkgdir/DESCRIPTION, start R, and do:

## R-Forge and CRAN versions of inlinedocs are deprecated since 3 June 2014.
## Instead, install from the updated version on GitHub:
install.packages("devtools")
devtools::install_github("tdhock/inlinedocs")
library(inlinedocs)
package.skeleton.dx("/path/to/your/pkgdir")

Then you are done! You will get Rd files in pkgdir/man that are guaranteed to pass R CMD check! Some notes/tips:

Extending the inlinedocs syntax with your own Parser Functions

inlinedocs operates using a modular system of source code parsers, so it is very simple to extend. To do this, you just need to write a custom Parser Function that takes your source as input and returns a list of documentation objects. For example, see the simple function in testfiles/alternate.R, which can be used as a Parser Function in the parsers argument to package.skeleton.dx().

Patch for ESS

The useful C-c C-f ESS command currently doesn't work with some valid R inlinedocs function definitions. A temporary remedy is to download the ESS source and change the ess-function-pattern variable:
wget http://ess.r-project.org/downloads/ess/ess-5.13.tgz
tar -xzf ess-5.13.tgz
cd ess-5.13
wget https://r-forge.r-project.org/scm/viewvc.php/*checkout*/lisp/ess-function-pattern-patch/ess-function-pattern-more-general.patch?root=inlinedocs -O ess-function-pattern.patch
patch -p0 < ess-function-pattern.patch

Return to the project summary page.

Please subscribe to the low-traffic inlinedocs-support list if you are using inlinedocs or have ideas to contribute, thanks!
Documentation en français
validate