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

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