<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/new-r-package-packagedocs/"></div></div><div><a data-url="https://www.r-bloggers.com/new-r-package-packagedocs/" data-counturl="https://www.r-bloggers.com/new-r-package-packagedocs/" data-count="horizontal" data-text="New R package: packagedocs" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://ryanhafen.com/blog/packagedocs"> Ryan Hafen</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>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.</p>
<p><span></span></p>
<p>You can see some examples of documentation generated with packagedocs <a target="_blank" rel="nofollow" href="http://hafen.github.io/rbokeh/">here</a>, <a target="_blank" rel="nofollow" href="http://deltarho.org/docs-datadr/">here</a>, and <a target="_blank" rel="nofollow" href="http://hafen.github.io/packagedocs/">here</a>.</p>
<p>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:</p>
<p><iframe height="394" width="700" allowfullscreen src="https://www.youtube.com/embed/kMA4xYTyOls?rel=0"></iframe></p>
<h2>Brief History</h2>
<p>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 <a target="_blank" rel="nofollow" href="https://github.com/hadley/pkgdown">staticdocs</a> 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 <a target="_blank" rel="nofollow" href="http://deltarho.org/">DeltaRho</a> 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 <a target="_blank" rel="nofollow" href="https://github.com/hadley/pkgdown">pkgdown</a>, also worth checking out.</p>
<h2>Features</h2>
<p>Here are some of the features of the package:</p>
<ul>
<li>All documentation is generated from a single RMarkdown file, <code>&quot;vignettes/docs.Rmd&quot;</code></li>
<li>Documentation is nicely styled and responsive for mobile viewing with a collapsible auto-scrolling table of contents</li>
<li>Simple Github / TravisCI hooks are provided for automatically building and deploying documentation to your github pages branch after each commit</li>
<li>Once configured, by default any commits pushed to the master branch of repository <code>https://github.com/username/reponame</code> will have docs made automatically available at <code>https://username.github.io/reponame</code></li>
<li>Valid R vignettes are generated that point to the live version of the docs</li>
<li>Automatic generation of all R object and function documentation, called the “function reference”</li>
<li>Examples in the function reference are evaluated and the output, including graphics, is rendered inline with the documentation</li>
<li>The function reference can be organized into groups with custom headings using a yaml configuration file</li>
<li>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</li>
<li>Helper functions to initialize, run, and set up your docs for Github deployment</li>
<li>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!</li>
</ul>
<h2>Installation</h2>
<p>From CRAN:</p>
<pre><code>install.packages(&quot;packagedocs&quot;)
</code></pre>
<p>From Github:</p>
<pre><code>devtools::install_github(&quot;hafen/packagedocs&quot;)
</code></pre>
<h2>Usage</h2>
<p>There are three main functions.</p>
<p>To initialize your packagedocs documentation:</p>
<pre><code># in current package directory
packagedocs::init_vignettes()
</code></pre>
<p>This will create some files in your package’s <code>&quot;vignettes&quot;</code> directory. Edit <code>&quot;vignettes/docs.Rmd</code>” and to generate your vignettes, run:</p>
<pre><code>packagedocs::build_vignettes()
</code></pre>
<p>To set up your repository to automatically build and deploy to your github pages branch on every commit:</p>
<pre><code>packagedocs::use_travis()
</code></pre>
<p>More detail about how to use the package is found in the package’s <a target="_blank" rel="nofollow" href="http://hafen.github.io/packagedocs">documentation</a>, generated of course using packagedocs!</p>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="https://www.r-bloggers.com/new-r-package-packagedocs/"></div></div><div><a data-url="https://www.r-bloggers.com/new-r-package-packagedocs/" data-counturl="https://www.r-bloggers.com/new-r-package-packagedocs/" data-count="vertical" data-text="New R package: packagedocs" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://ryanhafen.com/blog/packagedocs"> Ryan Hafen</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/E4F9s_FjbS4"></a></div>