30. Building R Packages

As of early February 2017, there were over 10,000 packages on CRAN and nearly 1,300 more on Bioconductor, with more being added daily. In the past, building a package had the potential to be mystifying and complicated but that is no longer the case, especially when using Hadley Wickham’s devtools package.

All packages submitted to CRAN (or Bioconductor) must follow specific guidelines, including the folder structure of the package, inclusion of DESCRIPTION and NAMESPACE files and proper help files.

30.1 Folder Structure

An R package is essentially a folder of folders, each containing specific files. At the very minimum there must be two folders, one called R where the included functions go, and the other called man where ...

Get R for Everyone: Advanced Analytics and Graphics, 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.