demo
Demonstrations of Package Functionality
Description
Run files in a package's demo directory. These files often
show how the functions in the package are expected to work together,
or how to use some tricky functionality in the package.
Usage
demo(topic, package = NULL, lib.loc = NULL, character.only = FALSE, verbose = getOption("verbose", FALSE), echo = TRUE, ask = getOption("demo.ask", "default"))
Arguments
topic |
a name or a character string. Specifies the demo to demonstrate.
|
package |
a character string that indicates the package where topic is searched. If NULL,
all loaded packages in the search list are used for topic searching.
|
lib.loc |
a character vector containing the names of library directories.
If lib.loc is NULL, .libPaths() is used.
|
character.only |
a logical value.
- If FALSE, an unquoted name is given as the topic argument.
For example, topic=foo is treated as the character string "foo" and
not as the value of the variable called foo.
- If TRUE, the topic argument is evaluated
as arguments usually are. For example, topic=foo is treated as the
value of the variable foo.
If a literal string is given, for example: topic="foo", the
value of character.only makes no difference.
|
verbose |
a logical value, passed to find.package (where, if a package is found
in two library directories, the first package found is used).
- If verbose is TRUE, a warning message is displayed.
- If verbose is FALSE (the default), no warning message is displayed.
|
echo |
a logical value. If TRUE (the default), each expression is printed,
along with a prompt, before it is evaluated.
|
ask |
a logical value or the string "default".
- If TRUE, displays a prompt to press the return key before
the demo is run.
- If "default", then use the value of the echo argument.
- If options("demo.ask") is set, then that value is used as the default value.
|
Value
- If topic is missing, it returns a "packageIQR" object listing demos in the specified package, including names and descriptions.
- If both topic and package are missing, it returns a "packageIQR" object listing demos in all available packages
or it returns the value of s evaluated expression in the demo file.
- Otherwise, it returns nothing of interest.
A
packageIQR is a
matrix with extra attributes that
print.packageIQR uses to format it to render a good display.
See Also
Examples
demo(package = "base") # should see "scoping" and its description
demo(scoping, package = "base") # run the "scoping" demo