<p>Welcome to the fourth post in the repulsively random R ramblings series, or <span>R4</span> for short.</p>
<p>My twitter feed was buzzing about a nice (and as yet unpublished, ie not-on-CRAN) package <a href="http://dirk.eddelbuettel.com/thankr">https://github.com/dirkschumacher/thankr</a> by <a href="https://www.dirk-schumacher.net/">Dirk Schumacher</a> which compiles a a list of packages (ordered by maintainer count) for your current session (or installation or ...) with a view towards saying thank you to those whose packages we rely upon. Very nice indeed.</p>
<p>I had a quick look and run it twice ... and had a reaction of ewwww, really? as running it twice gave different results as on the second instance a boatload of tibblyverse packages appeared. Because apparently kids these day can only slice data that has been tidied or something.</p>
<p>So I had another quick look ... and put together an alternative version using just base R (as there was only one subfunction that needed reworking):</p>
<div><pre><code><span>source</span>(<span>file=</span><span>&quot;https://raw.githubusercontent.com/dirkschumacher/thankr/master/R/shoulders.R&quot;</span>)
format_pkg_df &lt;-<span> </span>function(df) { <span># non-tibblyverse variant</span>
    tb &lt;-<span> </span><span>table</span>(df[,<span>2</span>])
    od &lt;-<span> </span><span>order</span>(tb, <span>decreasing=</span><span>TRUE</span>)
    ndf &lt;-<span> </span><span>data.frame</span>(<span>maint=</span><span>names</span>(tb)[od], <span>npkgs=</span><span>as.integer</span>(tb[od]))
    colpkgs &lt;-<span> </span>function(m, df) { <span>paste</span>(df[ df$maintainer ==<span> </span>m, <span>&quot;pkg_name&quot;</span>], <span>collapse=</span><span>&quot;,&quot;</span>) }
    ndf[, <span>&quot;pkg&quot;</span>] &lt;-<span> </span><span>sapply</span>(ndf$maint, colpkgs, df)
    ndf
}</code></pre></div>
<p>Running this in the <a href="https://ess.r-project.org/">ESS</a> session I had open gives:</p>
<div><pre><code>R><span> </span><span>shoulders</span>()  ## by Dirk Schumacher, with small modifications
                               maint npkgs                                                                 pkg
<span>1</span> R Core Team &lt;R-core@r-project.org><span> </span><span>9</span> compiler,graphics,tools,utils,grDevices,stats,datasets,methods,base
<span>2</span> Dirk Eddelbuettel &lt;edd@debian.org><span> </span><span>4</span>                                  RcppTOML,Rcpp,RApiDatetime,anytime
<span>3</span>  Matt Dowle &lt;mattjdowle@gmail.com><span> </span><span>1</span>                                                          data.table
R><span> </span></code></pre></div>
<p>and for good measure a screen is below:</p>
<div>
</div>
<p>
</p>
<p>I think we need a catchy moniker for R work using good old base R. SoberVerse? GrumbyOldFolksR? PlainOldR? Better suggestions welcome.</p>
<p>
This post by <a href="http://dirk.eddelbuettel.com/">Dirk Eddelbuettel</a> originated on his <a 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>