
R/clean_lyx.R, R/tangle_lyx.R, R/weave_lyx.R
clean_lyx.RdThese functions process .Rnw`` files produced by LyX and the SciViews Sweave module (not the standard Sweave module provided with LyX <= 2.0.0!). The SciViews-LyX extension defines rchunk` commands to contain R chunks
(embedded R code processed by Sweave). Unfortunately, LyX use to write two
lines feeds for each line of code, introducing extra lines in the R chunks.
Moreover, tabulations are interpreted as 8 spaces, while R code use to
consider a tabulation as equivalent to 4 spaces. clean_lyx() corrects
these little problems, and it should not affect R noweb files produced by a
different software.
clean_lyx(RnwCon, RnwCon2 = RnwCon, encoding = "UTF-8")
cleanLyxRnw(RnwCon, RnwCon2 = RnwCon, encoding = "UTF-8")
tangle_lyx(
file,
driver = Rtangle(),
syntax = getOption("SweaveSyntax"),
encoding = "UTF-8",
width = 80,
useFancyQuotes = TRUE,
annotate = TRUE,
logFile = file.path(tempdir(), ".lyxSweave.log"),
...
)
tangleLyxRnw(
file,
driver = Rtangle(),
syntax = getOption("SweaveSyntax"),
encoding = "UTF-8",
width = 80,
useFancyQuotes = TRUE,
annotate = TRUE,
logFile = file.path(tempdir(), ".lyxSweave.log"),
...
)
purl_lyx(
file,
encoding = "UTF-8",
width = 80,
useFancyQuotes = TRUE,
logFile = file.path(tempdir(), ".lyxSweave.log"),
...
)
purlLyxRnw(
file,
encoding = "UTF-8",
width = 80,
useFancyQuotes = TRUE,
logFile = file.path(tempdir(), ".lyxSweave.log"),
...
)
weave_lyx(
file,
driver = RweaveLatex(),
syntax = getOption("SweaveSyntax"),
encoding = "UTF-8",
width = 80,
useFancyQuotes = TRUE,
logFile = file.path(tempdir(), ".lyxSweave.log"),
...
)
weaveLyxRnw(
file,
driver = RweaveLatex(),
syntax = getOption("SweaveSyntax"),
encoding = "UTF-8",
width = 80,
useFancyQuotes = TRUE,
logFile = file.path(tempdir(), ".lyxSweave.log"),
...
)
knit_lyx(
file,
encoding = "UTF-8",
width = 80,
useFancyQuotes = TRUE,
logFile = file.path(tempdir(), ".lyxSweave.log"),
...
)
knitLyxRnw(
file,
encoding = "UTF-8",
width = 80,
useFancyQuotes = TRUE,
logFile = file.path(tempdir(), ".lyxSweave.log"),
...
)A connection object or a character string corresponding to the path to a R noweb file to be read.
Idem, but where the cleaned up R noweb file should be written (by default, on the same file or connection).
The encoding of the .Rnw file. It is UTF-8 by default, but
you can change it here.
The Sweave source file.
The actual function to do the process, see Sweave().
NULL or an object of class 'SweaveSyntax' or a character
string with its name, see Sweave().
The width used for outputs, 80 characters by default.
Do we use fancy quotes in R outputs?
Is the R code extracted from the .Rnw file annotated?
The file to use to log results of weaving/tangling the document.
Further arguments passed to the driver's setup function of
Sweave() or Stangle().
For clean_lyx(), a list for Sweave options found in the document; NULLfor the other functions: these functions are invoked for their side effects.
The function weave_lyx() uses the standard Sweave driver (but it uses knitr
for LyX documents that use the SciViews Knitr module), while knit_lyx()does the same, but using the knitr driver. Similarly, purl_lyx() is the
knitr counterpart of tangle_lyx() standard tangling function.