| Rtangle {utils} | R Documentation |
R Driver for Stangle
Description
A driver for Stangle that extracts R code chunks.
Usage
Rtangle()
RtangleSetup(file, syntax, output = NULL, annotate = TRUE,
split = FALSE, quiet = FALSE, ...)
Arguments
file |
Name of Sweave source file. See the description of the
corresponding argument of |
syntax |
An object of class |
output |
Name of output file used unless |
annotate |
By default, code chunks are separated by comment
lines specifying the names and numbers of the code chunks. If
|
split |
Split output into a file for each code chunk? |
quiet |
If |
... |
Additional named arguments setting defaults for further options. |
Details
Unless split = TRUE, the default name of the output file is
basename(file) with an extension corresponding to the Sweave
syntax (e.g. ‘Rnw’, ‘Stex’) replaced by ‘R’. File
names "stdout" and "stderr" are interpreted as the
output and message connection respectively.
If splitting is selected (including by the options in the file), each chunk is written to a separate file with extension the name of the ‘engine’ (default ‘.R’).
The annotation is of one of the forms
################################################### ### code chunk number 3: viewport ################################################### ################################################### ### code chunk number 18: grid.Rnw:647-648 ################################################### ################################################### ### code chunk number 19: trellisdata (eval = FALSE) ###################################################
using either the chunk label or the file name and line numbers.
Note that this driver does not simple extract the code chunks verbatim because code chunks can re-use earlier chunks.
Supported Options
Rtangle supports the following options for code chunks (the
values in parentheses show the default values):
- engine:
character string (
"R"). Only chunks withengineequal to"R"or"S"are processed.- keep.source:
logical (
TRUE). Ifkeep.source == TRUEthe original source is copied to the file. Otherwise, deparsed source is output.- eval:
logical (
TRUE). IfFALSE, the code chunk is copied across but commented out.- prefix
Used if
split = TRUE. Seeprefix.string.- prefix.string:
a character string, default is the name of the source file (without extension). Used if
split = TRUEas the prefix for the filename if the chunk has no label, or if it has a label andprefix = TRUE. Note that this is used as part of filenames, so needs to be portable.- show.line.nos
logical (
FALSE). Should the output be annotated with comments showing the line number of the first code line of the chunk?
Author(s)
Friedrich Leisch and R-core.
See Also
‘Sweave User Manual’, a vignette in the utils package.
Sweave, RweaveLatex