Learn R Programming

FRAPO (version 0.4-1)

BookEx: Utility functions for handling book examples

Description

Utility functions for returning a list of the included examples and displaying, executing, saving and editing the example codes are provided.

Usage

listEx() showEx(Example) saveEx(Example) editEx(Example, ...) runEx(Example, ...)

Arguments

Example
Characater, the name of the example as contained in listEx().
...
Ellipsis argument. See details.

Value

listEx Returns a character vector of the examples' names. showEx Returns the example of of Example to the console. saveEx Returns a logical whether the saving of the R code example into the working directory was successful. editEx Opens a copy of the example code in an editor. runEx Executes the example code.

Details

The ellipsis arguments in the function editEx() are passed down to the function file.edit(). If the option editor is unset and/or a different editor shall be employed for openening the example code, then the ellipsis argument can be utilised by editor = "foo", wherey foo is the name of the editor to be used. The ellipsis arguments in the function runEx() are passed down to the function source().

See Also

file.edit, source

Examples

Run this code
## Not run: 
# listEx()
# showEx(Example = "Part1Chapter3Ex2")
# saveEx(Example = "Part1Chapter3Ex2")
# runEx(Example = "Part1Chapter3Ex2", echo = TRUE)
# editEx(Example = listEx()[1], editor = "emacs")
# ## End(Not run)

Run the code above in your browser using DataLab