Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

xweave

Wrapper Function for Weaving Either Rnw or Rmd Exercises


Description

Simple wrapper function that either calls Sweave for Rnw exercises or knit for Rmd exercises.

Usage

xweave(file, quiet = TRUE, encoding = NULL, engine = NULL, envir = new.env(),
    pdf = TRUE, png = FALSE, svg = FALSE, height = 6, width = 6, resolution = 100,
    highlight = FALSE, ...)

Arguments

file, quiet, encoding

arguments passed to Sweave or knit, respectively.

engine

character indicating whether "Sweave" (default) or "knitr" should be used for rendering Rnw exercises.

envir

argument passed to knit. By default, or if envir = NULL a new.env() is created for each xweave() call.

pdf, png, svg, height, width, resolution, highlight, ...

arguments passed to Sweave or opts_chunk, respectively. In the latter case: pdf/png/svg are mapped to dev; height/width are mapped to fig.height/fig.width; and resolution is mapped to dpi. highlight is ignored for Sweave.

Details

Depending on whether file has an .Rnw or .Rmd suffix, either Sweave or knit is called for weaving the file by default. Rnw exercises can optionally also be weaved by knit by setting engine = "knitr".

If png = TRUE or svg = TRUE when calling Sweave, then the resulting includegraphics statements are supplemented with the .png or .svg suffix of the corresponding graphics. For svg a simple graphics device hook .xweave_svg_grdevice is provided on-the-fly for plug-in into Sweave.

See Also


exams

Automatic Generation of Exams in R

v2.3-6
GPL-2 | GPL-3
Authors
Achim Zeileis [aut, cre] (<https://orcid.org/0000-0003-0918-3766>), Bettina Gruen [aut] (<https://orcid.org/0000-0001-7265-4773>), Friedrich Leisch [aut] (<https://orcid.org/0000-0001-7278-1983>), Nikolaus Umlauf [aut], Mirko Birbaumer [ctb], Dominik Ernst [ctb], Patrik Keller [ctb], Niels Smits [ctb], Reto Stauffer [ctb], Kenji Sato [ctb]
Initial release
2020-04-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.