The exams2webquiz function is a convenience tool that sets up an
R/Markdown document embedding R/exams exercises in a (temporary) directory
and directly rendering it to an HTML page.
exams2webquiz(file, n = 1L, nsamp = NULL, dir = NULL,
name = "webquiz", title = "R/exams quiz", browse = TRUE, edir = NULL,
..., clean = TRUE, quiet = TRUE, envir = parent.frame())webquiz(...)
Invisible character vector containing the path of the Rmd document and rendered HTML file, respectively.
character. A specification of (a list of) exercise files.
integer. The number of copies to be taken from file.
integer. The number(s) of exercise files sampled from each
list element of file. Sampling without replacement is used
if possible. (Only if some element of nsamp is larger than
the length of the corresponding element in file, sampling
with replacement is used.)
character. A path in which the tutorial file is created, by default
chosen as a tempfile.
character. A name prefix for the resulting .Rmd document.
character. Title of the quiz.
logical. Should the resulting tutorial be displayed using
browseURL?
character. The path of the directory (along with its
sub-directories) in which the files in file are stored.
If both dir and edir are NULL (the default), the edir
is set to the current working directory.
arguments passed to exams2forms
(in exams2webquiz) or html_document
(in webquiz), respectively.
arguments passed to render.
exams2webquiz is a convenience function that sets up a .Rmd
document (in a temporary directory by default) and then calls render
from rmarkdown to quickly try out the quiz interactively.
webquiz is a small wrapper function that creates an
html_document but includes some custom CSS and
Javascript for the quiz display and user interactions. The idea and
original code is adapted from the webexercises package, authored
by Dale Barr and Lisa DeBruine.
For full customization it is recommended to set up a dedicated .Rmd file
within which exams2forms can be used to include
R/exams exercises.
exams2forms,
render
if (FALSE) {
## quickly render a quiz based on a set of R/exams exercises
ex <- c("swisscapital.Rmd", "capitals.Rmd", "fruit.Rmd", "function.Rmd", "lm2.Rmd")
exams2webquiz(ex)
}
Run the code above in your browser using DataLab