\Header{example}{Run an Examples Section from the Online Help}
\keyword{documentation}{example}
\keyword{utilities}{example}
\begin{Description}\relax
Run all the \R{} code from the \code{EXAMPLES} part of \R's online help
topic \code{topic}.\end{Description}
\begin{Usage}
\begin{verbatim}
example(topic, package = .packages(), lib,
        echo = TRUE, verbose = getOption("verbose"),
        prompt.echo = paste(abbreviate(topic, 6),"> ", sep=""))
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{topic}] name or character:  The online \code{\Link{help}} topic
the examples of which should be run.
\item[\code{package}] a character vector with package names.
\item[\code{lib}] a character vector with path names of \R{} package libraries.
\item[\code{echo}] logical;  if \code{TRUE}, show the \R{} input when sourcing.
\item[\code{verbose}] logical;  if \code{TRUE}, show even more when running
example code.
\item[\code{prompt.echo}] character; gives the prompt to be used if
\code{echo = TRUE}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
If \code{lib.loc} is not specified, the packages are searched for
amongst those already loaded. If \code{lib.loc} is specified,
they are searched for in the specified libraries, even if they are
already loaded from another library. An attempt is made to load the
package before running the examples, but this will not replace a
pacakge loaded from another location.\end{Details}
\begin{Value}
(the value of the last evaluated expression).\end{Value}
\begin{Note}\relax
The examples can be many small files. On some file systems it is
desirable to save space, and the files in the \file{R-ex} directory
of an installed package can be zipped up as a zip archive \file{Rex.zip}.\end{Note}
\begin{Author}\relax
Martin Maechler and others\end{Author}
\begin{SeeAlso}\relax
\code{\Link{demo}}\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
example("smooth", package="eda", lib.loc=.lib.loc)
example(dbinom)
\end{ExampleCode}
\end{Examples}

