Learn R Programming

relax (version 1.3.15)

CodeChunkPlayer: CodeChunkPlayer, ConstructDemo -- tools for browsing and evaluation of code chunks

Description

CodeChunkPlayer enables the user to evaluate code chunks interactively. ConstructDemo constructs a demo function from a file containing code chunks.

Usage

CodeChunkPlayer(file="") ConstructDemo(file="")

Arguments

file
name of rev-, Snw-file or .R-file containing code chunks

Value

CodeChunkPlayer and ConstructDemo don't have any explicit result.

Details

Both functions need a .R-file that has been generated by tangleR. If the input file is not a .R-file but an rev-file or an Snw-file the input file will be tangled by tangleR and a .R-file will be generated.

CodeChunkPlayer: CodeChunkPlayer extracts the code chunks stored in the .R-file and creates a Tcl/Tk window to show a code chunk selected by the user. The user can browse through the set of chunks by clicking on NEXT or bBACK or by typing the number of a code chunk. The code of the selected code chunk is shown in the text field of the player window and may be edited. By clicking button EVALUATE the code will be evaluated and the output occurs on the R console.

ConstructDemo: ConstructDemo extracts the code chunks of the .R-file and builds a new function for browsing through the code chunks. This function will contain the code chunks of the .R-file as well as the logic for browsing and evaluation of selected chunks. The function is stored with its call in a file whose name is composed from the name of the input file and the extension .demo.R. Therefore, you can start the demo function by e.g. source("xyz.demo.R") and a Tcl/Tk window for code chunk browsing will be created. This window works like the Tcl/Tk window that is generated by CodeChunkPlayer.

References

http://www.wiwi.uni-bielefeld.de/com/wolf/software/relax.html

Examples

Run this code
## CodeChunkPlayer()
## ConstructDemo()

Run the code above in your browser using DataLab