exams2pdf(file, n = 1L, nsamp = NULL, dir = ".", template = "plain",
inputs = NULL, header = list(Date = Sys.Date()), name = NULL,
control = NULL, encoding = "", quiet = TRUE, edir = NULL, tdir = NULL,
sdir = NULL, verbose = FALSE)
make_exams_write_pdf(template = "plain", inputs = NULL,
header = list(Date = Sys.Date()), name = NULL, quiet = TRUE,
control = NULL)
file
.file
. Sampling without replacement is used
if possible. (Only if some element of nsamp
is larger than
the length of the corresponding element in dir
is explicitly specified, the file is displayed on the
screen rather than saved in dir
."exam"
, "solution"
, "plain"
.
For details see below.edir
.template
.Sweave
.file
are stored (see also below).tempdir
. Note that this
is cleaned up and potentially temporary files are deleted.tempdir
.exams2pdf
is a more flexible re-implementation of the old (version 1)
exams
function (Gruen and Zeileis 2009), using the new extensible
xexams
framework (Zeileis et al. 2014). A detailed
introduction is provided in vignette("exams", package = "exams")
, also
pointing out relative advantages of the new interface.
exams2pdf
proceeds by using make_exams_write_pdf
to set up a custom
driver$write
function on the fly before calling xexams
.
This custom driver combines each exams with the desired template
(and inputs
etc.) and then calls texi2dvi
on the resulting LaTeX file to produce PDF output.
For a single exam (n = 1
) the resulting PDF is displayed on
screen (unless dir
is explicitly specified) while for n > 1
the PDF files are stored in the output directory dir
.Zeileis A, Umlauf N, Leisch F (2014).
Flexible Generation of E-Learning Exams in R: Moodle Quizzes, OLAT Assessments, and Beyond.
Journal of Statistical Software, 58(1), 1--36.
xexams
,
exams
,
texi2dvi
## load package and enforce par(ask = FALSE)
options(device.ask.default = FALSE)
if(interactive()) {
## compile a single random exam (displayed on screen)
exams2pdf(list(
"boxplots",
c("tstat", "ttest", "confint"),
c("regression", "anova"),
"scatterplot",
"relfreq"
))
}
Run the code above in your browser using DataLab