<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/roxygen2-6-0-0/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://blog.rstudio.org/2017/02/01/roxygen2-6-0-0/"> RStudio Blog</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>roxygen2 6.0.0 is now available on CRAN. roxygen2 helps you document your packages by turning specially formatted inline comments into R’s standard Rd format. It automates everything that can be automated, and provides helpers for sharing documentation between topics. Learn more at <a target="_blank" rel="nofollow" href="http://r-pkgs.had.co.nz/man.html">http://r-pkgs.had.co.nz/man.html</a>. Install the latest version with:</p>
<pre><code><span>install.packages</span><span>(</span><span>&quot;roxygen2&quot;</span><span>)</span></code></pre>
<p>There are two headline features in this version of roxygen2:</p>
<ul>
<li>Markdown support.</li>
<li>Improved documentation inheritance.</li>
</ul>
<p>These are described in detail below.</p>
<p>This release also included many minor improvements and bug fixes. For a full list of changes, please see <a target="_blank" rel="nofollow" href="https://github.com/klutometis/roxygen/releases/tag/v6.0.0">release notes</a>. A big thanks to all the contributors to this release: <a target="_blank" rel="nofollow" href="https://github.com/dlebauer">@dlebauer</a>, <a target="_blank" rel="nofollow" href="https://github.com/fmichonneau">@fmichonneau</a>, <a target="_blank" rel="nofollow" href="https://github.com/gaborcsardi">@gaborcsardi</a>, <a target="_blank" rel="nofollow" href="https://github.com/HenrikBengtsson">@HenrikBengtsson</a>, <a target="_blank" rel="nofollow" href="https://github.com/jefferis">@jefferis</a>, <a target="_blank" rel="nofollow" href="https://github.com/jeroenooms">@jeroenooms</a>, <a target="_blank" rel="nofollow" href="https://github.com/jimhester">@jimhester</a>, <a target="_blank" rel="nofollow" href="https://github.com/kevinushey">@kevinushey</a>, <a target="_blank" rel="nofollow" href="https://github.com/krlmlr">@krlmlr</a>, <a target="_blank" rel="nofollow" href="https://github.com/LiNk-NY">@LiNk-NY</a>, <a target="_blank" rel="nofollow" href="https://github.com/lorenzwalthert">@lorenzwalthert</a>, <a target="_blank" rel="nofollow" href="https://github.com/maxheld83">@maxheld83</a>, <a target="_blank" rel="nofollow" href="https://github.com/nteetor">@nteetor</a>, <a target="_blank" rel="nofollow" href="https://github.com/shrektan">@shrektan</a>, <a target="_blank" rel="nofollow" href="https://github.com/yutannihilation">@yutannihilation</a></p>
<div>
<h2>Markdown</h2>
<p>Thanks to the hard work of <a target="_blank" rel="nofollow" href="http://gaborcsardi.org/">Gabor Csardi</a> you can now write roxygen2 comments in markdown. While we have tried to make markdown mode as backward compatible as possible, there are a few cases where you will need to make some minor changes. For this reason, you’ll need to explicitly opt-in to markdown support. There are two ways to do so:</p>
<ul>
<li>Add <code>Roxygen: list(markdown = TRUE)</code> to your <code>DESCRIPTION</code> to turn it on everywhere.</li>
<li>Add <code>@md</code> to individual roxygen blocks to enable for selected topics.</li>
</ul>
<p>roxygen2’s markdown dialect supports inline formatting (bold, italics, code), lists (numbered and bulleted), and a number of helpful link shortcuts:</p>
<ul>
<li><code>[func()]</code>: links to a function in the current package, and is translated to <code>\code{\link[=func]{func()}.</code></li>
<li><code>[object]</code>: links to an object in the current package, and is translated to <code>\link{object}.</code></li>
<li><code>[link text][object]</code>: links to an object with custom text, and is translated to <code>\link[=link text]{object}</code></li>
</ul>
<p>Similarly, you can link to functions and objects in other packages with <code>[pkg::func()]</code>, <code>[pkg::object]</code>, and <code>[link text][pkg::object]</code>. For a complete list of syntax, and how to handle common problems, please see <code>vignette(&quot;markdown&quot;)</code> for more details.</p>
<p>To convert an existing roxygen2 package to use markdown, try <a target="_blank" rel="nofollow" href="https://github.com/r-pkgs/roxygen2md">https://github.com/r-pkgs/roxygen2md</a>. Happy markdown-ing!</p>
</div>
<div>
<h2>Improved inheritance</h2>
<p>Writing documentation is challenging because you want to reduce duplication as much as possible (so you don’t accidentally end up with inconsistent documentation) but you don’t want the user to have to follow a spider’s web of cross-references. This version of roxygen2 provides more support for writing documentation in one place then reusing in multiple topics.</p>
<p>The new <code>@inherit</code> tag allows to you inherit parameters, return, references, title, description, details, sections, and seealso from another topic. <code>@inherit my_fun</code> will inherit everything; <code>@inherit my_fun return params</code> will allow to you inherit specified components. <code>@inherits fun sections</code> will inherit all sections; if you’d like to inherit a single section, you can use <code>@inheritSection fun title</code>. You can also inherit from a topic in another package with <code>@inherit pkg::fun</code>.</p>
<p>Another new tag is <code>@inheritDotParams</code>, which allows you to automatically generate parameter documentation for <code>...</code> for the common case where you pass <code>...</code> on to another function. The documentation generated is similar to the style used in <code>?plot</code> and will eventually be incorporated in to RStudio’s autocomplete. When you pass along <code>...</code> you often override some arguments, so the tag has a flexible specification:</p>
<ul>
<li><code>@inheritDotParams foo</code> takes all parameters from <code>foo()</code>.</li>
<li><code>@inheritDotParams foo a b e:h</code> takes parameters <code>a</code>, <code>b</code>, and all parameters between <code>e</code> and <code>h</code>.</li>
<li><code>@inheritDotParams foo -x -y</code> takes all parameters except for <code>x</code> and <code>y</code>.</li>
</ul>
<p>All the <code>@inherit</code> tags (including the existing <code>@inheritParams</code>) now work recursively, so you can inherit from a function that inherited from elsewhere.</p>
<p>If you want to generate a basic package documentation page (accessible from <code>package?packagename</code> and <code>?packagename</code>), you can document the special sentinel value <code>&quot;_PACKAGE&quot;</code>. It automatically uses the title, description, authors, url and bug reports fields from the <code>DESCRIPTION</code>. The simplest approach is to do this:</p>
<pre><code><span>#' @keywords internal</span>
<span>&quot;_PACKAGE&quot;</span></code></pre>
<p>It only includes what’s already in the DESCRIPTION, but it will typically be easier for R users to access.</p>
</div>
<p> <a target="_blank" rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/rstudioblog.wordpress.com/4057/"><img alt="" src="http://feeds.wordpress.com/1.0/comments/rstudioblog.wordpress.com/4057/" border="0"></a> <img alt="" src="https://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" border="0" data-recalc-dims="1"></p>
<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://blog.rstudio.org/2017/02/01/roxygen2-6-0-0/"> RStudio Blog</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/search/tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/search/data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/search/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/search/ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/search/map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/search/animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/search/sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/search/SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/search/git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/search/hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/search/PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/search/time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/search/trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/TV_zDsiQaCg"></a></div>