<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/4-simpler-shoulders/"></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/08#004_simpler_shoulders"> 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 fourth post in the <em>repulsively random R ramblings</em> series, or <span><em>R</em><sup>4</sup></span> for short.</p>
<p>My twitter feed was buzzing about a nice (and as yet unpublished, ie not-on-CRAN) package <a target="_blank" rel="nofollow" href="http://dirk.eddelbuettel.com/blog/2017/04/thankr">https://github.com/dirkschumacher/thankr</a> by <a target="_blank" rel="nofollow" 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 <em>thank you</em> 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 <em>ewwww, really?</em> 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 target="_blank" rel="nofollow" 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>
<img src="https://i0.wp.com/dirk.eddelbuettel.com/blog/2017/04/08/shoulders-example.png?w=456" data-recalc-dims="1">
</div>
<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 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/08#004_simpler_shoulders"> 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/hx6AiSwjBUs"></a></div>