Skip to Content
R Packages, 2nd Edition
book

R Packages, 2nd Edition

by Hadley Wickham, Jennifer Bryan
June 2023
Intermediate to advanced content levelIntermediate to advanced
381 pages
9h 2m
English
O'Reilly Media, Inc.
Content preview from R Packages, 2nd Edition

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

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

R Packages

R Packages

Hadley Wickham
R Cookbook, 2nd Edition

R Cookbook, 2nd Edition

JD Long, Paul Teetor
Advanced R

Advanced R

Hadley Wickham

Publisher Resources

ISBN: 9781098134938Errata Page