Explore R package connections at MRAN

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

Many R scripts depend on CRAN packages, and most CRAN packages in turn depend on other CRAN packages. If you install an R package, you'll also be installing its dependencies to make it work, and possibly other packages as well to enable its full functionality.

My colleague Andrie posted some R code to map package dependencies a couple of months ago, but now you can easily explore the dependencies of any CRAN package at MRAN. Simply search for a package and click the Dependencies Graph tab. Here's a very simple one: the foreach package.

MRAN-foreach

The foreach package depends on two others: iterators and codetools, which will be automatically installed for you by install.packages when you install foreach.  (We'll duscuss the use of “Suggests” — as here with randomForest — later.) Now let's look at a more complex example: the caret package

MRAN-caret

The caret package provides an interface to many of the predictive modeling packages on CRAN, and so it has several dependencies (nine, in fact — you can see the list by clicking on the Dependencies Table tab). But it also Suggests many more packages — these are packages that are not required to run caret, but if you do have them, there are more model types you can use within the caret framework.

Here's a quick overview of the types of dependencies you'll find in the charts and tables on MRAN:

  • Imports (red) and Depends (orange). These packages are required to use the package of interest. Their dependencies are also required, and shown in the graph. (As a package user, you don't need to worry about the distinction between Imports and Depends, but if you're interested Hadley Wickham's excellent Guide to R Packages has the details.)
  • Suggests (grey). These are packages that add additional functionality to the package of interest, but aren't required to use it. You may find certain functions or options don't work if the Suggested packages are not installed and loaded.
  • LinkingTo (black): Only relevant if you are working with compiled code. If you need to have the package installed, it will also be listed as a dependency. (Again, see Guide to R Packages for details.)
  • Enhances (blue): Very few packages use this type of link, but if they do it indicates that the package provides optional capabilities in another package. (It's sort of a reverse Suggests.)

MRAN is updated daily, and so the Dependencies Graph is always up-to-date with the latest CRAN packages and their connections. Start exploring at the link below.

MRAN: Explore 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)