O'Reilly logo

R Packages by Hadley Wickham

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 11. Installed Files

When a package is installed, everything in inst/ is copied into the top-level package directory. In some sense inst/ is the opposite of .Rbuildignore—where .Rbuildignore lets you remove arbitrary files and directories to the top level, inst/ lets you add them. You are free to put anything you like in inst/ with one caution: because inst/ is copied into the top-level directory, you should never use a subdirectory with the same name as an existing directory. This means that you should avoid inst/build, inst/data, inst/demo, inst/exec, inst/help, inst/html, inst/inst, inst/libs, inst/Meta, inst/man, inst/po, inst/R, inst/src, inst/tests, inst/tools, and inst/vignettes.

This chapter discusses the most common files found in inst/:

  • inst/AUTHOR and inst/COPYRIGHT: If the copyright and authorship of a package is particularly complex, you can use plain-text files inst/COPYRIGHTS and inst/AUTHORS to provide more information.

  • inst/CITATION: How to cite the package, see “Package Citation” for details.

  • inst/docs: This is an older convention for vignettes, and should be avoided in modern packages.

  • inst/extdata: Additional external data for examples and vignettes. See “Raw Data” for more detail.

  • inst/java, inst/python, etc.: See “Other Languages”.

To find a file in inst/ from code use system.file(). For example, to find inst/extdata/mydata.csv, you’d call system.file("extdata", "mydata.csv", package = "mypackage"). Note that you omit the inst/ directory ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required