Description Usage Arguments Value References See Also Examples
This function finds and runs a file, usually of R code. The function is specialized to look for examples included in the package and based on material in Software for Data Analysis, but can be used for other directories containing source files as well.
1 | runExample(what, where = , run = TRUE, ..., echo = TRUE, prompt.echo, wd)
|
what |
Identifies the example to be run. Can be either a character string name of the file to be run,
possibly without the suffix or the page in Software for
Data Analysis where the example appears. See
|
where |
The character string name of the package or directory
in which the files are to be found. By
default, and usually, it is
the |
run |
Should the example code be run, or only parsed, assuming it is R source code? |
..., echo, prompt.echo |
Any optional arguments to the |
wd |
The working directory in which to run the example. If the
argument is missing and If |
If the file is an R source file, the function returns either the
value from source
or the parsed version of the file,
according to whether run
is TRUE
.
For non-R files, the value is currently just the character vector containing the lines of the file. Future versions may be a little more clever.
Chambers, John M.(2008) Software for Data Analysis, Springer.
demoSource
for a more interactive way to run a
file of R code, and exampleFiles
for direct access to
the path of the file.
1 2 3 4 5 | ## Not run:
runExample("madCall") # run file "madCall.R"
runExample(53) # the example appearing on page 53 of the book.
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.