<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/idle-thoughts-lead-to-r-internals-how-to-count-function-arguments/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://nsaunders.wordpress.com/2018/06/22/idle-thoughts-lead-to-r-internals-how-to-count-function-arguments/"> R – What You're Doing Is Rather Desperate</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>“Some R functions have an awful lot of arguments”, you think to yourself. “I wonder which has the most?”<br>
<span></span></p>
<p>It’s not an original thought: the same question as applied to the R <em>base</em> package is an exercise in the <a rel="nofollow" href="https://adv-r.hadley.nz/functions.html" target="_blank">Functions chapter</a> of the excellent <em>Advanced R</em>. Much of the information in this post came from there. </p>
<p>There are lots of R packages. We’ll limit ourselves to those packages which ship with R, and which load on startup. Which ones are they?</p>
<p><strong>What packages load on starting R?</strong><br>
Start a new R session and type <code>search()</code>. Here’s the result on my machine:</p>
<p><code><br>
search()<br>
 [1] &quot;.GlobalEnv&quot;        &quot;tools:rstudio&quot;     &quot;package:stats&quot;     &quot;package:graphics&quot;  &quot;package:grDevices&quot;<br>
     &quot;package:utils&quot;     &quot;package:datasets&quot;  &quot;package:methods&quot;   &quot;Autoloads&quot;         &quot;package:base&quot;<br>
</code></p>
<p>We’re interested in the packages with <em>priority = base</em>. Next question:</p>
<p><strong>How can I see and filter for package priority?</strong><br>
You don’t need <code>dplyr</code> for this, but it helps.</p>
<pre>
library(tidyverse)

installed.packages() %>% 
  as.tibble() %>% 
  filter(Priority == &quot;base&quot;) %>% 
  select(Package, Priority)

# A tibble: 14 x 2
   Package   Priority
   </pre>