Chapter 11. Dependencies: In Practice

This chapter presents the practical details of working with your dependencies inside your package. If you need a refresher on any of the background:

We’re finally ready to talk about how to use different types of dependencies within the different parts of your package:

  • In your functions, below R/

  • In your tests, below tests/testthat

  • In your examples, in the help topics, below man/

  • In your vignettes and articles, below vignettes/

Confusion About Imports

Let’s make this crystal clear:

Listing a package in Imports in DESCRIPTION does not “import” that package.

It is natural to assume that listing a package in Imports actually “imports” the package, but this is just an unfortunate choice of name for the Imports field. The Imports field makes sure that the packages listed there are installed when your package is installed. It does not make those functions available to you, e.g., below R/, or to your user.

It is neither automatic nor necessarily advisable that a package listed in Imports also appears in NAMESPACE via imports() or ...

Get R Packages, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.