A look at the distribution of R package dependencies

December 12, 2013
By

(This article was first published on Revolutions, and kindly contributed to R-bloggers)

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.

CRANberries2

(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.

  Depends

(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 his blog: Revolutions.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.