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

Get R Packages 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.