RtangleExtra {RweaveExtra} | R Documentation |
R Driver for Stangle with Additional Options
Description
A driver for Sweave
extending the standard driver
Rtangle
with additional code chunk options.
Usage
RtangleExtra()
RtangleExtraSetup(file, syntax, output = NULL, annotate = TRUE,
split = FALSE, quiet = FALSE, drop.evalFALSE = FALSE,
ignore.on.tangle = FALSE, ignore = FALSE,
extension = TRUE, chunk.sep = "\n\n", ...)
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 |
|
split |
Split output into a file for each code chunk? |
quiet |
Logical to suppress all progress messages. |
drop.evalFALSE |
See |
ignore.on.tangle |
If |
ignore |
An alternative way to set both |
extension |
Extension to use for the file name, without the
leading dot, when splitting is selected. If |
chunk.sep |
Text to use as separator between code chunks. The
default value reproduces the output of the standard
|
... |
See |
Details
Chunks ignored on tangling are not written out to script files, but
they are processed normally on weaving (unless ignore = TRUE
).
Therefore, chunks may still use eval = TRUE
for weaving
purposes, yet not be tangled.
The argument extension
is specially useful with
ignore.on.weave = TRUE
of RweaveExtraLatex
to
include code or text that the engine would not be able to parse.
The argument chunk.sep
offers control over the chunk separator
that the standard Rtangle
driver does not. The
chunk separator is added before all chunks, except the first
one. Therefore, no chunk separator follows the last chunk. No newline
(aka ‘line feed’) is added to the value of the argument. Using
control characters (e.g. ‘\n’) in a code chunk option is not
supported.
Value
Named list
of five functions; see Sweave
or the ‘Sweave User Manual’ vignette in the utils
package.
Author(s)
Vincent Goulet, based on work by Friedrich Leisch and R-core.
See Also
RweaveExtraLatex
, Rtangle
,
Sweave
.
Examples
testfile <- system.file("examples", "example-extra.Rnw",
package = "RweaveExtra")
## Check the contents of the file
if (interactive()) file.show(testfile)
## Tangle the file in the current working directory
Stangle(testfile, driver = RtangleExtra())
## View tangled file
if (interactive()) file.show("example-extra.R")
## Reduce to spacing between code chunks to a single
## blank line
Stangle(testfile, driver = RtangleExtra(), chunk.sep = "\n")
if (interactive()) file.show("example-extra.R")
## The effect of 'chunk.sep=FALSE' in the second chunk
## is more interesting without the annotations
Stangle(testfile, driver = RtangleExtra(),
annotate = FALSE, chunk.sep = "\n")
if (interactive()) file.show("example-extra.R")
## Use 'extension=sh' with 'ignore.on.weave=TRUE', and
## the options 'split=TRUE' and 'prefix=FALSE' of Stangle
## to extract the shell script to a file 'hello.sh'
Stangle(testfile, driver = RtangleExtra(),
split = TRUE, annotate = FALSE)
if (interactive()) file.show("hello.sh")