Title: | Sweave Drivers with Extra Tricks Up their Sleeve |
---|---|
Description: | Weave and tangle drivers for Sweave extending the standard drivers. RweaveExtraLatex and RtangleExtra provide options to completely ignore code chunks on weaving, tangling, or both. Chunks ignored on weaving are not parsed, yet are written out verbatim on tangling. Chunks ignored on tangling may be evaluated as usual on weaving, but are completely left out of the tangled scripts. The driver RtangleExtra also provides an option to specify the extension of the file name (or remove it entirely) when splitting is selected on tangling. |
Authors: | Vincent Goulet [cre, aut], R Core Team [aut] (Code from the original Sweave drivers) |
Maintainer: | Vincent Goulet <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.1-0 |
Built: | 2024-11-17 02:53:04 UTC |
Source: | https://github.com/cran/RweaveExtra |
Weave and tangle drivers for Sweave extending the standard drivers. RweaveExtraLatex and RtangleExtra provide options to completely ignore code chunks on weaving, tangling, or both. Chunks ignored on weaving are not parsed, yet are written out verbatim on tangling. Chunks ignored on tangling may be evaluated as usual on weaving, but are completely left out of the tangled scripts. The driver RtangleExtra also provides an option to specify the extension of the file name (or remove it entirely) when splitting is selected on tangling.
The RweaveExtraLatex
and RtangleExtra
drivers extend the standard Sweave
drivers
RweaveLatex
and
Rtangle
, respectively. They are selected
through the driver
argument of Sweave
.
The drivers provide additional options to completely ignore code
chunks on weaving, tangling, or both. Chunks ignored on weaving are
not parsed and are written out verbatim on tangling. Chunks ignored on
tangling are processed as usual on weaving, but completely left out of
the tangled scripts. The driver RtangleExtra
also
provides the option extension
to specify the extension of the
file name (or remove it entirely) when splitting is selected.
In a literate programming workflow, the additional options allow to include code chunks in a file such as:
code that is not parsable by R (say, because of errors inserted for educational purposes);
code in another programming language entirely (say, a shell script to start an analysis);
code for a Shiny app.
With the standard drivers, using option eval = FALSE
results in
code being commented out in tangled scripts files. Chunks may be
omitted on tangling with drop.evalFALSE = TRUE
, but only
provided the chunk is not evaluated on weaving. Therefore, the
standard drivers have no provision to either omit a chunk on weaving
and tangle it as is, or to process a chunk on weaving but omit it
on tangling.
Vincent Goulet [cre, aut], R Core Team [aut] (Code from the original Sweave drivers)
Maintainer: Vincent Goulet <[email protected]>
A driver for Sweave
extending the standard driver
Rtangle
with additional code chunk options.
RtangleExtra() RtangleExtraSetup(file, syntax, output = NULL, annotate = TRUE, split = FALSE, quiet = FALSE, drop.evalFALSE = FALSE, ignore.on.tangle = FALSE, ignore = FALSE, extension = NULL, ...)
RtangleExtra() RtangleExtraSetup(file, syntax, output = NULL, annotate = TRUE, split = FALSE, quiet = FALSE, drop.evalFALSE = FALSE, ignore.on.tangle = FALSE, ignore = FALSE, extension = NULL, ...)
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 |
... |
See |
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.
Named list
of five functions; see Sweave
or the ‘Sweave User Manual’ vignette in the utils
package.
Vincent Goulet, based on work by Friedrich Leisch and R-core.
RweaveExtraLatex
, Rtangle
,
Sweave
.
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") ## 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")
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") ## 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")
A driver for Sweave
extending the standard driver
RweaveLatex
with additional code chunk options.
RweaveExtraLatex() RweaveExtraLatexSetup(file, syntax, output = NULL, quiet = FALSE, debug = FALSE, stylepath, ignore.on.weave = FALSE, ignore = FALSE, ...)
RweaveExtraLatex() RweaveExtraLatexSetup(file, syntax, output = NULL, quiet = FALSE, debug = FALSE, stylepath, ignore.on.weave = FALSE, ignore = FALSE, ...)
file |
Name of Sweave source file. See the description of the
corresponding argument of |
syntax |
An object of class |
output |
Name of output file. See
|
quiet |
If |
debug |
If |
stylepath |
See |
ignore.on.weave |
If |
ignore |
An alternative way to set both |
... |
See |
Chunks ignored on weaving are not parsed and are not evaluated, but
they are written out on tangling as normal code chunks (unless
ignore=TRUE
).
If ignore.on.weave
or ignore
is FALSE
, the code
chunk is processed using the standard driver
RweaveLatex
with its options.
Named list
of five functions; see Sweave
or the ‘Sweave User Manual’ vignette in the utils
package.
Vincent Goulet, based on work by Friedrich Leisch and R-core.
RtangleExtra
, RweaveLatex
,
Sweave
.
testfile <- system.file("examples", "example-extra.Rnw", package = "RweaveExtra") ## Check the contents of the file if(interactive()) file.show(testfile) ## Weave, then tangle the file in the current working directory Sweave(testfile, driver = RweaveExtraLatex()) Stangle(testfile, driver = RtangleExtra()) ## View weaved and tangled files if(interactive()) file.show("example-extra.tex") if(interactive()) file.show("example-extra.R")
testfile <- system.file("examples", "example-extra.Rnw", package = "RweaveExtra") ## Check the contents of the file if(interactive()) file.show(testfile) ## Weave, then tangle the file in the current working directory Sweave(testfile, driver = RweaveExtraLatex()) Stangle(testfile, driver = RtangleExtra()) ## View weaved and tangled files if(interactive()) file.show("example-extra.tex") if(interactive()) file.show("example-extra.R")