| exams2ans | R Documentation |
Automatic generation of exams in QTI 2.1 with some tweaks (still under development) for the online testing system Ans.
exams2ans(file, n = 1L, dir = ".", name = "anstest",
converter = "pandoc-mathjax", maxattempts = 1, cutvalue = NULL, ...)
file |
character. A specification of a (list of) exercise files. |
n |
integer. The number of copies to be compiled from |
dir |
character. The default is the current working directory. |
name |
character. A name prefix for resulting exercises and XML file. |
converter |
character passed on to |
maxattempts |
integer. The maximum attempts for one question. |
cutvalue |
numeric. The number of points at which the exam is passed. |
... |
arguments passed on to |
exams2ans is a convenience interface to exams2qti21
for generating QTI 2.1 with some small tweaks for Ans
(https://www.ans.app). The supported exercise types at the
moment are num, schoice, mchoice, and string. There is limited support for cloze exercises:
It only allows for questions with similar item types (choice items versus fill-in items), meaning that
only combinations of schoice and mchoice items or combinations of numeric and string items
are allowed.
The Ans-specific tweaks currently include:
Ans only recognizes HTML with mathematical notation created with "pandoc-mathjax",
which is set as default.
The Ans system does not properly render html-<pre> environments and requires an
additional adjustment of the QTI XML.
Ans has its own unique way of setting tolerance for numeric questions, which is incorporated in the function.
exams2ans returns a list of exams as generated by xexams.
Ans (2025). Exercises and Questions. Available at https://support.ans.app/hc/en-us/sections/360004983014-Exercises-Questions
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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v058.i01")}.
exams2qti21
## load package and enforce par(ask = FALSE)
library("exams")
options(device.ask.default = FALSE)
## define an exams (= list of exercises)
myexam <- c(
"boxplots.Rmd",
"tstat.Rmd",
"ttest.Rmd",
"relfreq.Rmd",
"fourfold.Rmd"
)
## output directory
dir.create(mydir <- tempfile())
## generate .zip with Ans test in temporary directory
exams2ans(myexam, dir = mydir)
dir(mydir)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.