A look at the distribution of R package dependencies

[This article was first published on Revolutions, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

by Joseph Rickert

For a knitty gritty look at what’s new with R there is no better place to start than Dirk Eddelbuettel’s CRANberries site. Since 2007, the site has been reliably providing near real-time status on CRAN packages. Now, every two hours, CRANberries displays updated information on new R packages, updated R packages and R packages that have been removed. The following is a partial view of today’s CRAN: New page.


(Since we first featured this site on the Revolutions blog Dirk has spruced up its looks and added a twitter feed.)

Referring to his site in the About page Dirk states: “There is not much to it, R already gives us a function available.packages().The part about there not being much to it is clearly an understatement: Dirk has harnessed a good bit of technology and a significant amount of know how to make things work smoothly. However, it is the case that available.packages() is a pretty amazing function. available.packages() links to CRAN and returns a boatload of information about the packages there including name, version, Depends, Imports, Suggests and much more. 

As first exercise, I thought it would be interesting to look just at the Depends field, which as the Writing R Extensions Manual explains, gives a comma-separated list of package names which a given package depends on, and can also specify a dependence on a certain version of R. The following histogram shows a single snapshot of the distribution of the number of dependencies in CRAN packages.


(Download Depends to get the code for the histogram.)

Most packages have fewer than 3 dependencies (median = 2), but there are 33 packages that have 10 or more. The winner is the sisus package for “source partitioning using stable isotopes” with 19 dependencies.

The help file for the function indicates that it is possible to get even more package information than is included in the default settings. available.packages() provides a window into CRAN and R that with a little work could provide some real insight into the structure of R packages.

To leave a comment for the author, please follow the link and comment on their blog: Revolutions.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)