20.1 Package Structure

The most simple package contains a DESCRIPTION file, housing metadata about the package (e.g. name and authors), and an R/ directory where .R files with function definitions live.

Packages may also contain:

  • A data/ directory, which holds reference datasets.
  • A tests/ directory, which holds unit-tests that are used to ensure code works as expected.
  • A vignettes/ directory, which holds long-form documentation.
  • More! Read Hadley Wickham and Jenny Bryan’s amazing book, R Packages