demo {utils} | R Documentation |
Demonstrations of R Functionality
Description
demo
is a user-friendly interface to running some demonstration
R scripts. demo()
gives the list of available topics.
Usage
demo(topic, package = NULL, lib.loc = NULL,
character.only = FALSE, verbose = getOption("verbose"),
type = c("console", "html"), echo = TRUE,
ask = getOption("demo.ask"),
encoding = getOption("encoding"))
Arguments
topic |
the topic which should be demonstrated, given as a
name or literal character string, or a character string,
depending on whether |
package |
a character vector giving the packages to look into for
demos, or |
lib.loc |
a character vector of directory names of R libraries,
or |
character.only |
logical; if |
verbose |
a logical. If |
type |
character: whether to show output in the console or a
browser (using the dynamic help system). The latter is honored only
in interactive sessions and if the |
echo |
a logical. If |
ask |
a logical (or |
encoding |
See |
Details
If no topics are given, demo
lists the available demos. For
type = "console"
, the corresponding information is returned in
an object of class "packageIQR"
.
See Also
source
and devAskNewPage
which
are called by demo
. example
to run code
in the Examples section of help pages.
Examples
demo() # for attached packages
## All available demos:
demo(package = .packages(all.available = TRUE))
## Display a demo, pausing between pages
demo(lm.glm, package = "stats", ask = TRUE)
## Display it without pausing
demo(lm.glm, package = "stats", ask = FALSE)
## Not run:
ch <- "scoping"
demo(ch, character = TRUE)
## End(Not run)
## Find the location of a demo
system.file("demo", "lm.glm.R", package = "stats")