<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/6-easiest-package-registration/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://dirk.eddelbuettel.com/blog/2017/04/30#006_easiest_package_registration"> Thinking inside the box </a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>Welcome to the sixth post in the <em>really random R riffs</em> series, or <span><em>R</em><sup>4</sup></span> for short.</p>
<p>Posts <a target="_blank" rel="nofollow" href="http://dirk.eddelbuettel.com/blog/2017/03/29#001_easy_package_registration">#1</a> and <a target="_blank" rel="nofollow" href="http://dirk.eddelbuettel.com/blog/2017/03/30#002_even_easier_package_registration">#2</a> discussed how to get the now <em>de rigeur</em> package registration information computed. In essence, we pointed to something which R 3.4.0 would have, and provided tricks for accessing it while R 3.3.3 was still R-released.</p>
<p>But now R 3.4.0 is out, and life is good! Or at least this is easier. For example, a few days ago I <a target="_blank" rel="nofollow" href="https://github.com/eddelbuettel/littler/commit/002b3255225f7b690acb36179fd762ee4c6877b8">committed</a> this short helper script <code>pnrrs.r</code> to <a target="_blank" rel="nofollow" href="http://dirk.eddelbuettel.com/code/littler.html">littler</a>:</p>
<div>
<pre><code><span>#!/usr/bin/r</span>

if (<span>getRversion</span>() &lt;<span> &quot;3.4.0&quot;</span>) <span>stop</span>(<span>&quot;Not available for R (&lt; 3.4.0). Please upgrade.&quot;</span>, <span>call.=</span><span>FALSE</span>)

tools::<span>package_native_routine_registration_skeleton</span>(<span>&quot;.&quot;</span>)</code></pre>
</div>
<p>So with this example script <code>pnrrs.r</code> soft-linked to <code>/usr/local/bin</code> (or <code>~/bin</code>) as I commonly do with <a target="_blank" rel="nofollow" href="http://dirk.eddelbuettel.com/code/littler.html">littler</a> helpers, all it takes is</p>
<div>
<pre><code><span>cd</span> some/R/package/source
<span>pnrrs.r</span></code></pre>
</div>
<p>and the desired file usable as <code>src/init.c</code> is on <code>stdout</code>. Editing <code>NAMESPACE</code> is quick too, and we’re all done. See the <a target="_blank" rel="nofollow" href="http://dirk.eddelbuettel.com/blog/2017/03/29#001_easy_package_registration">other</a> <a target="_blank" rel="nofollow" href="http://dirk.eddelbuettel.com/blog/2017/03/30#002_even_easier_package_registration">two</a> posts for additional context. If you don’t have <a target="_blank" rel="nofollow" href="http://dirk.eddelbuettel.com/code/littler.html">littler</a>, the above also works with <code>Rscript</code>.</p>
<p>
This post by <a target="_blank" rel="nofollow" href="http://dirk.eddelbuettel.com/">Dirk Eddelbuettel</a> originated on his <a target="_blank" rel="nofollow" href="http://dirk.eddelbuettel.com/blog/">Thinking inside the box</a> blog. Please report excessive re-aggregation in third-party for-profit settings.</p>
<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="http://dirk.eddelbuettel.com/blog/2017/04/30#006_easiest_package_registration"> Thinking inside the box </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/I5gI1Tw6dio"></a></div>