New R package: packagedocs

[This article was first published on Ryan Hafen, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I’m pleased to announce the CRAN release of packagedocs which provides a mechanism for simple generation and automated deployment of nice-looking online R package documentation that plugs into the traditional R package vignette system.

You can see some examples of documentation generated with packagedocs here, here, and here.

A feature list and usage guide is provided below, but it’s probably easiest to get a feel for what the package does by watching this short screencast:

Brief History

packagedocs has been around in one form or another for quite some time and is a successor of, heavily influenced by, and borrows from Hadley Wickham’s staticdocs package. packagedocs was conceived from the desire to have a package’s vignettes and function reference all rendered into a single website with several features for convenience and utility which I’ll list below. We’ve been using it for a few years to render the documentation for packages in our DeltaRho project. Recently Barret Schloerke jumped in and revamped the package to improve and add several features and get it ready to release on CRAN. I didn’t realize until writing this post that staticdocs, which has been relatively dormant for the past few years, is now being actively revamped, and is now known as pkgdown, also worth checking out.


Here are some of the features of the package:

  • All documentation is generated from a single RMarkdown file, "vignettes/docs.Rmd"
  • Documentation is nicely styled and responsive for mobile viewing with a collapsible auto-scrolling table of contents
  • Simple Github / TravisCI hooks are provided for automatically building and deploying documentation to your github pages branch after each commit
  • Once configured, by default any commits pushed to the master branch of repository will have docs made automatically available at
  • Valid R vignettes are generated that point to the live version of the docs
  • Automatic generation of all R object and function documentation, called the “function reference”
  • Examples in the function reference are evaluated and the output, including graphics, is rendered inline with the documentation
  • The function reference can be organized into groups with custom headings using a yaml configuration file
  • A convenience function is provided for linking references to functions in your vignette directly to the associated function documentation on the generated function reference page
  • Helper functions to initialize, run, and set up your docs for Github deployment
  • Github pages branch is stomped on each commit to prevent repository bloat – NOTE: this is important – if you use this package, make sure you don’t care about version control history in your gh-pages branch!


From CRAN:


From Github:



There are three main functions.

To initialize your packagedocs documentation:

# in current package directory

This will create some files in your package’s "vignettes" directory. Edit "vignettes/docs.Rmd” and to generate your vignettes, run:


To set up your repository to automatically build and deploy to your github pages branch on every commit:


More detail about how to use the package is found in the package’s documentation, generated of course using packagedocs!

To leave a comment for the author, please follow the link and comment on their blog: Ryan Hafen. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)