Skip to Content
R Packages
book

R Packages

by Hadley Wickham
March 2015
Intermediate to advanced
202 pages
4h 23m
English
O'Reilly Media, Inc.
Content preview from R Packages

Chapter 12. Other Components

There are four other directories that are valid, top-level directories. They are rarely used:

demo/
For package demos. These were useful prior to the introduction of vignettes, but are no longer recommended. See the following section for more information.
exec/
For executable scripts. Compared to other directories, files in exec/ are automatically flagged as executable.
po/
Translations for messages. This is useful but beyond the scope of this book. See the Internationalization chapter of “R extensions” for more details.
tools/
Auxiliary files needed during configuration, or for sources that need to generate scripts.

Demos

A demo is an .R file that lives in demo/. Demos are like examples but tend to be longer. Instead of focusing on a single function, they show how to weave together multiple functions to solve a problem.

You list and access demos with demo():

  • To show all available demos, use demo().
  • To show all demos in a package, use demo(package = "httr").
  • To run a specific demo, use demo("oauth1-twitter", package = "httr").
  • To find a demo, use system.file("demo", "oauth1-twitter.R", package = "httr").

Each demo must be listed in demo/00Index in the following form: demo-name Demo description. The demo name is the name of the file without the extension (e.g., demo/my-demo.R becomes my-demo).

By default, the demo asks for human input for each plot: “Hit to see next plot:” This behavior can be overridden by adding devAskNewPage(ask = FALSE) to ...

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, 2nd Edition

R Packages, 2nd Edition

Hadley Wickham, Jennifer Bryan
Nonparametric Hypothesis Testing: Rank and Permutation Methods with Applications in R

Nonparametric Hypothesis Testing: Rank and Permutation Methods with Applications in R

Stefano Bonnini, Livio Corain, Marco Marozzi, Luigi Salmaso

Publisher Resources

ISBN: 9781491910580Errata Page